#C25.txt: Getting ready for the Ramanujan movie, April 21, 2016 Help:=proc(): print(`SeqPSS(N), SeqPS(N), p(n) , SeqP(N) , FindRC(L) `): end: with(combinat): with(numtheory): #SeqPSS(N): A super stupid (very slow) program to output the first #N terms (starting at n=1) of the number of integer-partitions of n SeqPSS:=proc(N) local i: [seq(nops(partition(i)),i=1..N)]: end: #SeqPS(N): A little stupid (less slow) program to output the first #N terms (starting at n=1) of the number of integer-partitions of n #using Leonhard Euler's generating function #Sum(p(n)*q^n,n=0..infinity)=1/mul(1-q^i,i=1..infinity) SeqPS:=proc(N) local i,f,q: f:= taylor(1/mul(1-q^i,i=1..N), q=0, N+1): [seq( coeff(f,q,i),i=1..N)]: end: #p(n): the number of partitions of n, using Euler's recurrence given a beautiful #combinatorial proof by David Bressoud and Dr. Z. #p(n)=p(n-1)+p(n-2) +...- (-1)^j* ( p(n-j*(3*j+1)/2) + p(n-j*(3*j-1)/2) )+... p:=proc(n) local j,su: option remember: if n<0 then RETURN(0): elif n=0 then RETURN(1): else su:=0: for j from 1 while j*(3*j-1)/2 <=n do su:= su+ (-1)^(j+1)* ( p(n-j*(3*j+1)/2) + p(n-j*(3*j-1)/2) ) : od: RETURN(su): fi: end: #SeqP(N): A clever program to output the first #N terms (starting at n=1) of the number of integer-partitions of n #using Leonhard Euler's recurrence SeqP:=proc(N) local n: [seq( p(n),n=1..N)]: end: #FindRC(L): Inputs a sequence of integers #L, all the Ramaujan congruences inspired by # p(5*n+4) == 0 mod 5, of the form #L [prime*n + j] == 0 mod prime for prime nops(L)/20 #The output is the set [prime,j] with that property FindRC:=proc(L) local p1,S,j,i: p1:=2: S:=[]: while p1<=nops(L)/20 do for j from 0 to p1-1 do if {seq(L[p1*i+j] mod p1 ,i=1..(nops(L)-j)/p1)}={0} then S:=[op(S), [p1,j]]: fi: od: p1:=nextprime(p1): od: S: end: