Search This Blog

26 February 2007

Sum of Series

sum of odd integers < 2n = n2

sum of all integers = n(n+1)/2

16 February 2007

Pascals' Cototients

Similar to yesterdays' post, this one is based off the totients of the values in Pascal's triangle.. but this time, we are displaying the Cototients (n - totient(n))...

15 February 2007

Pascal's Totients

I was trying to figure out new ways to look at Pascals' Triangle today, and decided to look not at the actual binomial coefficients, but at the Euler Totients of them. Take a gander.

12 February 2007

Pascal and Binomial Coefficients

I realized that I never really showed how Pascal's Triangle is related to the Binomial Coefficients... So here we go:


(x+1)0 =
1

(x+1)1 =
1x + 1 =
1 1

(x+1)2 =
(x+1)(x+1) =
x*x + x*1 + 1*x + 1*1 =
1x2 + 2x + 1 =
1 2 1

(x+1)3 =
(x+1)(x+1)(x+1) =
((x+1)(x+1))(x+1) =
(1x2 + 2x + 1)(x+1) =
(1x2*x + 1x2)+(2x*x + 2x*1)+(1*x + 1*1)=
1x3 + 1x2 + 2x2 + 2x + x + 1 =
1x3 + 3x2 + 3x + 1 =
1 3 3 1


(x+1)4 =
(x+1)(x+1)(x+1)(x+1) =
((x+1)(x+1)(x+1))(x+1) =
(1x3 + 3x2 + 3x + 1)(x+1) =
(1x3*x + 1x3*1)+(3x2*x + 3x2*1)+(3x*x + 3x*1)+(1*x + 1*1) =
1x4 + 1x3 + 3x3 + 3x2 + 3x2 + 3x + 1x + 1 =
1x4 + 4x3 + 6x2 + 4x + 1 =
1 4 6 4 1

07 February 2007

A Modded Pacal Triangle


As you generate very large Pascal Triangles, the numbers quickly get out of control. If you are planning on modding the values after obtaining them, why not mod them first?

Here you see an example of doing a mod5 before writing the number down... So, for example, the middle element on Row#4 is 1 because (3+3)%5 = 6%5 = 1... Now, you can use the number 1 for further rows instead of the original number 6.

06 February 2007

Binary Representation of Pascal's Triangle



To look like this, one thing you might do is work out all the values of the previous lines and then mod them to determine whether they should be highlighted or not.



Yet another way might be to just keep track of whether the values above are 1 or 0, and realize that the next one down is only 0 if both the parent hexes are 1.



But, how about a way to do it without any regard to previous rows? This method is quite simple...



Let's say you want to examine nCr (n=row, r=col)... say, 5C2 (10 if you look at the image)...



How do we do it? First, write down the binary value of n and r.


n (5) = 101
r (2) = 010


Now, if ANY digit in r is larger than the corresponding digit in n, it is even. Otherwise, it is odd.


Looking at our example, we compare:









bits
210
n101
r010
r[1] is higher than n[1] so it is even


So, to determine if any point in Pascals' Triangle is odd/even, you just have to compare the binary representation of the row and column. :)