Writing programs usually means understanding an algorithm well enough to represent that algorithm as code. And once you get to a certain level of complexity, that involves programming concepts like loops, which rest on mathematical concepts like getting every element of a set once, but not more than once.
So probability + combinatorics (the mathematics of counting according to a definition of a set) is a good place to start, and khan academy can help you there:
https://www.khanacademy.org/math/precalculus/prob-comb
This Coursera course may be of interest to you, and it is starting soon:
https://www.coursera.org/learn/combinatorics