For min/max gene hunters, there's a gene for good math ability, called the SPOCK1 gene.
Actually found a lot in East Asians/primarily Chinese:
Mathematics ability is a complex cognitive trait with polygenic heritability. Genome-wide association study (GWAS) has been an effective approach to investigate genetic components underlying mathematic ability. Although previous studies reported several candidate genetic variants, none of them...
pubmed.ncbi.nlm.nih.gov
What is Maths Ability? Maths or mathematical ability can be defined as the mental ability needed to acquire knowledge or skill in mathematics, which
www.xcode.life
Another one but for logical thinking (common for Taiwanese Hakka people):
Here in this study we adopted genome-wide association studies (GWAS) to investigate the genetic components of the personality constructs in the Chinese Personality Assessment Inventory 2 (CPAI-2) in Taiwanese Hakka populations, who are likely the descendants of a recent admixture between a group...
pubmed.ncbi.nlm.nih.gov
Keep in mind this doesn't mean that if you don't have that gene you won't or can't be good at Math. It just means it'll come easier to some than others.
If you work hard and really put the time in you can close the distance as
@Black Haven pointed out. You got to keep grinding problems and working it into your muscle memory. This goes from basic math to higher levels of Engineering, Math and Physics.