Size : 1.672 Kb
Type : txt
Here you can see an example of the output of the code.
It is interesting to analyze Pascal's Triangle a little bit more. The following picture illustrates the triangular array, in which you can observe that each term equals the sum of the previous two terms.
Then a question arises: what if we represent Pascal's Triangle modulo some prime? Here we provide the code to do so using any prime. The code also counts how many numbers in the displayed triangle are divisible by the chosen prime and how many are not.
Size : 1.104 Kb
Type : txt
Here you can find an example of the output of the code using modulo 2. Note that if there is a 0 it means that the corresponding binomial coefficient is divisible by 2, and if there is a 1 it means that the corresponding binomial coefficient is not divisible by 2.
You can see that we obtain Sierpinski's Triangle, which is a fractal in the form of equilateral triangles. In the following picture you can see how Sierpinski's Triangle is constructed and compare it to the picture above.
In general, depending on the prime we will obtain different variations of Sierpinski's Triangle. We can compare the number of entries in the Triangle that are not divisible by the chosen prime as the Triangle grows large. We can plot the number of entries that are not divisible by the chosen prime in function of the number of rows in Pascal's Triangle and then linearize the results. We obtain an almost perfect line for modulo 2, 3, 5 and 7. In the following pictures you can observe the plots with the results.