To be good at programming you can be good at math, however the two disciplines are completely unrelated to each other. The people with the highest aptitude for programming are people who are also gifted in the compositional arts such as music, painting, writing, film or theater directing or even choreography.
In the 1960's an insurance company did a study to find out who they should hire to train to program their mainframes (as computer science as a college major did not exist yet). They found that musicians and English teachers made the best programmers (in that order).
I've been working professionally as a software developer since 1982. And indeed the best programmers were those people who were good at music, in particular composition and arranging. The very worst programmers I ever worked with had PhD's in math. I've worked with two such people and they had zero knack for programming.
I was always good at math, but I'm also a musician, composer and writer. It is these latter talents that allow me to be a good programmer.