According to this Inverse article, it is estimated that about 1/5 of math ability is genetic. The ROBO1 gene effects the volume and activity of grey matter in the brain and there is compelling evidence, based on a study of 3 and 6 year-olds, showing that this effects how the brain perceives math. However, genes are not the only thing affecting math ability. The study took the same 3 and 6 year-olds and tested their math ability again after a few years of learning math and the study showed that 80% of the variance in math ability was not genetic, but rather how they learned. One study showed how parents who have higher test scores have children who have higher test scores, but, of course, families tend to pass down environmental factors along with the genetic ones. So, genetics does play a role in mathematical ability, but it is part of a bigger puzzle with a mix of genetic, environmental, and social factors.