My [question @ StackOverflow][1] just got closed as not programing related so I'm posting here. Please refer to the question @ SO, since: - sorry, new users can only post a maximum of one hyperlink - sorry, new users aren't allowed to use image tags ---------- Back in the days when I was in high-school I developed a big interest about number theory specifically prime numbers and prefect numbers, I used to stay awake all night long with a bunch of sketch papers trying to come up with a formula to generate / test prime numbers. I discovered a lot of things by my own like `(p * (p + 1)) / 2` is a perfect number when p is a [Mersenne][2] [prime][3]. I was so obsessed back then that I used to make mental calculations when I was asleep, I remember one day waking up really excited because I had discovered that `2^p - 2 MOD p == 0` when p is a prime, only to discover a few weeks later that [Pierre de Fermat][4] had [a similar idea][5] but, unfortunately it didn't work for [pseudoprimes][6]. I was very disappointed back then and I started playing with the [Pascal][7] [Triangle][8]. Blaise Pascal, Marin Mersenne and Pierre de Fermat were contemporaneous and shared thoughts with letters, in fact if you think a bit both the [Mersenne prime formula][9] and the [Fermat primality test][10] seem to be closely related with the rows of the [Pascal Triangle][11] (the sum of all numbers in row *n* is `2^n` where the first and last numbers are 1, hence the -1 in the Mersenne formula and -1 or -2 in the primality tests). I coded a Pascal Triangle generator with PHP and HTML that highlighted all the numbers that were multiples of a specific number and the results amazed me, and until this day I don't know why this happens and I would very much like to know why. Instead of trying to explain, I'll post here the images. **Composite Numbers (hover the image to see the highlighted divisor):** ![multiples of 4][12] ![multiples of 6][13] ![multiples of 8][14] ![multiples of 9][15] ![multiples of 10][16] **Prime Numbers (hover the image to see the highlighted divisor):** ![multiples of 2][17] ![multiples of 3][18] ![multiples of 5][19] ![multiples of 7][20] ![multiples of 11][21] I think the difference is obvious, but if you're confused just say so and I'll try to go into it a bit more... **Can anyone explain me why does this happens?** [1]: http://stackoverflow.com/questions/1922846/pascal-triangle-and-prime-numbers