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 [Edited to include enough links and images by GJK.] ---------- 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 prime][2]. 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 = 0 \pmod p$ when $p$ is a prime, only to discover a few weeks later that Pierre de Fermat had [a similar idea][3] but, unfortunately it didn't work for [pseudoprimes][4]. I was very disappointed back then and I started playing with the [Pascal triangle][5]. 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 and the Fermat primality test seem to be closely related with the rows of the Pascal triangle (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 Example:** ![multiples of 6][6] **Prime Example:** ![multiples of 2][7] I think the difference [between the prime and composite cases] 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 [2]: http://en.wikipedia.org/wiki/Mersenne_prime [3]: http://en.wikipedia.org/wiki/Fermat_primality_test [4]: http://en.wikipedia.org/wiki/Pseudoprime [5]: http://en.wikipedia.org/wiki/Pascal_triangle [6]: http://i48.tinypic.com/23jsnyq.jpg [7]: http://i50.tinypic.com/xp0due.jpg