Partition Function P

Author

Eric W. Weisstein
April 21, 2017

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/PartitionFunctionP.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/PartitionFunctionP.html.

©2017 Wolfram Research, Inc. except for portions noted otherwise

Enumeration

PartitionsP[Range[10]]

Primes

(p=Position[PartitionsP[Range[3000]],_?PrimeQ]//Flatten)//Timing

PartitionsP/@Take[p,10]

Length[l=Import["/Volumes/Users/Data/Math/PartitionsPPrimes.txt","Table"][[All,2]]]

b046063.txt

Do[
Print[{i,l[[i]],PrimeQ[PartitionsP[l[[i]]]]//Timing}],
{i,Length[l]}
]

Largest Proven Prime

http://primes.utm.edu/top20/page.php?id=54#records

Grid[data=Reverse[Cases[Import["http://primes.utm.edu/top20/page.php?id=54#records","Data"],{__,"Partitions, ECPP"},∞][[All,{2,3}]]/.p_String:>FromDigits[StringReplace[p,"p("~~n__~~")":>n]]],Dividers->All,Alignment->{Automatic,Decimal}]

$Version

Do[Print[{data[[n]],PrimeQ[PartitionsP[data[[n,1]]]]//Timing}],{n,Length[data]}]

Largest PRP

data={
130086648,(* 2017-02-03 *)
130123073, (* 2017-02-07 *)
130142600, (* 2017-02-09 *)
221444161,(* 2017-04-20: Serge *)
1000007396  (* 2017-02-12 *)
};

Do[Print[{data[[n]],IntegerLength[p=PartitionsP[data[[n]]]],PrimeQ[p]//Timing}],{n,Length[data]}]

Counts

Powers of 10

Table[PartitionsP[10^n],{n,0,5}]

N[%]//ScientificForm

1 to 100

System`PartitionsP

Context[PartitionsP]

?PartitionsP

Table[PartitionsP[n],{n,100}]

DiscreteMath`Combinatorica`NumberOfPartitions

?NumberOfPartitions

Table[NumberOfPartitions[n],{n,100}]

System`Private`DirectPartitionsP

?System`Private`DirectPartitionsP

Table[System`Private`DirectPartitionsP[n],{n,100}]

Greedy Algorithm

Table[Length[GreedyAll[PowersList[n,1],n]],{n,10}]

Table[Table[Length[GreedyAll[PowersList[n,k],n]],{n,50}],{k,2,4}]

Table[Join[{Length[GreedyAll[PowersList[10,k],10]]},Table[Length[GreedyAll[PowersList[n,k],n]],{n,50,300,50}]],{k,3,4}]

Generating Functions

Table[PartitionsP[n],{n,10}]

(((2 (t^(1/8)))/((Subscript[ϑ, 1]^′)(0,(Sqrt[t]))))^(1/3))==1+t+2 (t^2)+3 (t^3)+5 (t^4)+7 (t^5)+11 (t^6)+15 (t^7)+22 (t^8)+30 (t^9)+42 (t^10)+O((t^11))

expr1=(2t^(1/8)/EllipticThetaPrime[1,0,Sqrt[t]])^(1/3);

Series[expr1,{t,0,10}]

CoefficientList[%,t]

PartitionsP[Range[0,10]]

SeriesCoefficient[expr1,{t,0,n}]

(1/(QPochhammer2[x, x]))

1/Product[1-x^m,{m,∞}]

Product[1/(1-x^m),{m,∞}]

expr2=(1/(QPochhammer[t,t]));

Series[expr2,{t,0,10}]

CoefficientList[%,t]

PartitionsP[Range[0,10]]

SeriesCoefficient[expr2,{t,0,n}]

GeneratingFunction[PartitionsP[n],n,q]

Comparison

FullSimplify[expr1-expr2,0<t<1]

Table[Block[{t=RandomReal[WorkingPrecision->200]},expr1-expr2],{20}]//Chop//Union

Pentagonal

Sum[(-1)^n x^(n(3n+1)/2),{n,-∞,∞}]

Sum[(-1)^n x^(n(3n+1)/2),{n,-3,3}]

Pentagonal[n_]:=n(3n-1)/2
PentagonalGeneralized[n_?EvenQ]:=Module[{k=n/2},k(3k+1)/2]
PentagonalGeneralized[n_?OddQ]:=Module[{k=(n+1)/2},k(3k-1)/2]

PartitionsPSum[n_]:=Module[{i=0,s=0,p},
		While[(p=PentagonalGeneralized[i])<=n,
			s+=(-1)^(Floor[(i+1)/2]) PartitionsP[n-p];
			i++
		];
		s
]

Table[PartitionsPSum[n],{n,1,20}]

PartitionsP[3]-PartitionsP[2]-PartitionsP[1]

PartitionsP[4]-PartitionsP[3]-PartitionsP[2]

PartitionsP[5]-PartitionsP[4]-PartitionsP[3]+PartitionsP[0]

Table[n(3n-1)/2,{n,-3,3}]

Table[PentagonalGeneralized[i],{i,0,10}]

Table[Pentagonal[i],{i,10}]

Table[PartitionsP[n],{n,10}]

PartitionsP[1]+PartitionsP[2]

Partitions into Odd Numbers = Partitions without Duplication

(1/((∏_k^∞)(1-(x^(2 k-1)))))

1/Product[(1-x^(2k-1)),{k,∞}]

Series[((-1+x)/(x QPochhammer[(1/x),(x^2)])),{x,0,20}]

(∏_k^∞)((x^k)+1)

Product[(1+x^k),{k,∞}]

Series[(1/2) QPochhammer[-1,x],{x,0,20}]

(∏_(k=1,3,5,...)^∞)(∑_(i=0)^∞)(x^(i k))

Sum[x^(i k),{i,0,∞}]

Product[-(1/(-1+(x^k))),{k,1,∞,2}]

Product[-(1/(-1+(x^(2k+1)))),{k,0,∞}]

Series[Product[Sum[x^(i k),{i,0,20}],{k,1,20,2}],{x,0,20}]

CoefficientList[%,x]

Table[Count[Partitions[n],_?(And@@OddQ/@#&)],{n,20}]

Partitions into Odd and Unequal Parts

Product[1+x^k,{k,1,∞,2}]

Series[QPochhammer[-x,(x^2)],{x,0,20}]

CoefficientList[%,x]

SeriesCoefficient[QPochhammer[-x,(x^2)],{x,0,n}]

1/Product[1+(-1)^k q^k,{k,∞}]//InputForm

Series[1/Product[1+(-1)^k q^k,{k,50}],{q,0,20}]

Series[QPochhammer[-q,q^2],{q,0,20}]

(Partitions into an even number of unequal parts)-(partitions into an odd number of unequal parts)

<<Combinatorica`

f[n_]:=Module[{p=Length/@Select[Split/@Partitions[n],Union[Length/@#]=={1}&]},
Subtract@@{Count[p,_?EvenQ],Count[p,_?OddQ]}
]

Table[f[n],{n,25}]

Series[Product[1-z^k,{k,50}],{z,0,30}]

CoefficientList[%,z]

Solve[k==1/2n(3n+#),n]&/@{-1,1}

Module[{n},
1+Sum[z^k Which[
IntegerQ[n=(1/6) (-1+(Sqrt[1+24 k]))],(-1)^n,
IntegerQ[n=(1/6) (1+(Sqrt[1+24 k]))],(-1)^n,
True,0],{k,30}]
]

Euler Identity

Product[1+(z^k),{k,∞}]

Series[Product[1+(z^k),{k,20}],{z,0,10}]

Product[(1/(1-(z^(2k-1)))),{k,∞}]

Series[((-1+z)/(z QPochhammer[(1/z),(z^2)])),{z,0,10}]

Honsberger

No Even Part Repeated = No  Part More Than Three Times = No Part Divisible by 4

Series[Product[((1+(x^(2k)))/(1-(x^(2k-1)))),{k,100}],{x,0,20}]

Series[Product[1+(x^k)+(x^(2k))+(x^(3k)),{k,100}],{x,0,20}]

Series[Product[((1-(x^(4k)))/(1-(x^k))),{k,100}],{x,0,20}]

CoefficientList[%,x]

Count[Unequal@@DeleteCases[#,_?OddQ]&/@#,True]&/@Partitions/@Range[20]

Count[Max/@Map[Length,Split/@#,{2}],_?(#<4&)]&/@Partitions/@Range[20]

Count[Mod[#,4],_?(FreeQ[#,0]&)]&/@Partitions/@Range[20]

No Part Occurs more than 3 Times

Product[((1+(x^(2k)))/(1-(x^(2k-1)))),{k,∞}]//FullSimplify

Table[SeriesCoefficient[(((-1+x) QPochhammer[-1,(x^2)])/(2 x QPochhammer[(1/x),(x^2)])),{x,0,n}],{n,10}]

Product[(1+(x^k)+(x^(2k))+(x^(3k))),{k,∞}]

CoefficientList[Series[Product[(1+(x^k)+(x^(2k))+(x^(3k))),{k,100}],{x,0,10}],x]

Product[((1-(x^(4k)))/(1-(x^k))),{k,∞}]

Table[SeriesCoefficient[((QPochhammer[(x^4),(x^4)])/(QPochhammer[x,x])),{x,0,n}],{n,10}]

No Part Occurs more than d Times

Product[Sum[(x^(i k)),{i,0,d}],{k,∞}]

Every Part Occurs 2, 3, or 5 Times

Product[1+(x^(2k))+(x^(3k))+(x^(5k)),{k,∞}]//InputForm

Series[Product[1+(x^(2k))+(x^(3k))+(x^(5k)),{k,100}],{x,0,20}]

Product[(1+(x^(2k)))(1+(x^(3k))),{k,∞}]

Series[(1/4) QPochhammer[-1,(x^2)] QPochhammer[-1,(x^3)],{x,0,20}]

Product[((1-(x^(4k)))/(1-(x^(2k))))((1-(x^(6k)))/(1-(x^(3k)))),{k,∞}]

Series[((QPochhammer[(x^4),(x^4)] QPochhammer[(x^6),(x^6)])/(QPochhammer[(x^2),(x^2)] QPochhammer[(x^3),(x^3)])),{x,0,20}]

CoefficientList[%,x]

Count[Complement[#,{2,3,5}]&/@Map[Length,Split/@#,{2}],{}]&/@Partitions/@Range[20]

FullSimplify[Subtract@@{(1/4) QPochhammer[-1,(x^2)] QPochhammer[-1,(x^3)],((QPochhammer[(x^4),(x^4)] QPochhammer[(x^6),(x^6)])/(QPochhammer[(x^2),(x^2)] QPochhammer[(x^3),(x^3)]))}]

No Part Occurs Exactly Once

Simplify[(1+Sum[(x^(k n)),{n,2,∞}])//Together]

Product[((-1+(x^k)-(x^(2 k)))/(-1+(x^k))),{k,∞}]//InputForm

Series[Product[((-1+(x^k)-(x^(2 k)))/(-1+(x^k))),{k,100}],{x,0,20}]

Product[((1+(x^(3k)))/(1-(x^(2k)))),{k,∞}]

Series[((QPochhammer[-1,(x^3)])/(2 QPochhammer[(x^2),(x^2)])),{x,0,20}]

Product[((1-(x^(6k)))/((1-(x^(2k)))(1-(x^(3k))))),{k,∞}]

Series[Product[((1-(x^(6k)))/((1-(x^(2k)))(1-(x^(3k))))),{k,100}],{x,0,20}]

CoefficientList[%,x]

Generating Functions

Generating Function

Sum[PartitionsP[n]x^n,{n,0,∞}]//FullSimplify

GeneratingFunction[PartitionsP[n],n,z]

ExponentialGeneratingFunction

Sum[PartitionsP[n]((x^n)/(n!)),{n,0,∞}]

ExponentialGeneratingFunction[PartitionsP[n],n,z]

DirichletGeneratingFunction

Sum[((PartitionsP[n])/(n^s)),{n,∞}]

Lambert Series

Sum[((PartitionsP[n](x^n))/(1-(x^n))),{n,∞}]

Congruences

(∑_n^∞)P(5 n) (q^n)≡(∏_n^∞)(((1-(q^(5 n-3))) (1-(q^(5 n-2))) (1-(q^(5 n))))/((((1-(q^(5 n-4))))^2) (((1-(q^(5 n-1))))^2))) (mod 5)

Sum[PartitionsP[5n]q^n,{n,0,∞}]

c1=CoefficientList[Sum[PartitionsP[5n]q^n,{n,0,10}],q]

Product[(1-q^(5n-3))(1-q^(5n-2))(1-q^(5n))/(1-q^(5n-4))^2/(1-q^(5n-1))^2,{n,∞}]

c2=CoefficientList[Series[%,{q,0,10}],q]

Mod[c1,5]

Mod[c2,5]

(∑_(n=0)^∞)p(5 n+1) (q^n)==(∏_n^∞)((1-(q^(5 n)))/((1-(q^(5 n-4))) (1-(q^(5 n-1))))) (mod 5)

Sum[PartitionsP[5n+1](q^n),{n,0,∞}]

c1=CoefficientList[Sum[PartitionsP[5n+1]q^n,{n,0,10}],q]

Product[((1-(q^(5n)))/((1-(q^(5n-4)))(1-(q^(5n-1))))),{n,∞}]

c2=CoefficientList[Series[%,{q,0,10}],q]

Mod[c1,5]

Mod[c2,5]

(∑_(n=0)^∞)p(5 n+2) (q^n)==2 (∏_n^∞)((1-(q^(5 n)))/((1-(q^(5 n-3))) (1-(q^(5 n-2))))) (mod 5)

Sum[PartitionsP[5n+2](q^n),{n,0,∞}]

c1=CoefficientList[Sum[PartitionsP[5n+2]q^n,{n,0,10}],q]

2Product[((1-(q^(5n)))/((1-(q^(5n-3)))(1-(q^(5n-2))))),{n,∞}]

c2=CoefficientList[Series[%,{q,0,10}],q]

Mod[c1,5]

Mod[c2,5]

(∑_(n=0)^∞)p(5 n+3) (q^n)==3 (∏_n^∞)(((1-(q^(5 n-4))) (1-(q^(5 n-1))) (1-(q^(5 n))))/((((1-(q^(5 n-2))))^2) (((1-(q^(5 n-3))))^2))) (mod 5)

Sum[PartitionsP[5n+3](q^n),{n,0,∞}]

c1=CoefficientList[Sum[PartitionsP[5n+3]q^n,{n,0,10}],q]

3Product[(((1-(q^(5n-4)))(1-(q^(5n-1)))(1-(q^(5n))))/((((1-(q^(5n-2))))^2)(((1-(q^(5n-3))))^2))),{n,∞}]

c2=CoefficientList[Series[%,{q,0,10}],q]

Mod[c1,5]

Mod[c2,5]

Sums

(∑_(n=0)^∞)p(n) (x^n)==(1/(QPochhammer2[x, x]))

V8

$Version

Sum[PartitionsP[n] x^(n),{n,0,Infinity}]

(∑_k^n)(((-1))^(k+1)) (p(n-(1/2) k (3 k-1))+p(n-(1/2) k (3 k+1)))==p(n)

p[0]:=1
p[n_]:=p[n]=Sum[(-1)^(k+1)(p[n-k(3k-1)/2]+p[n-k(3k+1)/2]),{k,n}]

Table[{PartitionsP[n],p[n]},{n,20}]

Sum[(-1)^(k+1)(PartitionsP[n-k(3k-1)/2]+PartitionsP[n-k(3k+1)/2]),{k,n}]//InputForm

Subtract@@@Table[{Sum[(-1)^(k+1)(PartitionsP[n-k(3k-1)/2]+PartitionsP[n-k(3k+1)/2]),{k,n}],PartitionsP[n]},{n,100}]//Union

V8

Sum[(-1)^(k+1)(PartitionsP[n-k(3k-1)/2]+PartitionsP[n-k(3k+1)/2]),{k,n}]

(∑_(k=0)^(⌊n/2⌋))p(k) q(n-2 k)==p(n)

Sum[PartitionsQ[n-2k]PartitionsP[k],{k,0,Floor[n/2]}]

(1/n)(∑_(k=0)^(n-1))p(k) (Subscript[σ, 1])(n-k)==p(n)

(1/n)Sum[DivisorSigma[1,n-k]PartitionsP[k],{k,0,n-1}]

(∑_(k=⌈- ((Sqrt[24 n+1])+1)/6⌉)^(⌊ ((Sqrt[24 n+1])-1)/6⌋))(((-1))^k) p(n-(1/2) k (3 k+1))==0

sum[n_]:=Sum[(-1)^k PartitionsP[n-k(3k+1)/2],
{k,Ceiling[-(Sqrt[24n+1]+1)/6],Floor[(Sqrt[24n+1]-1)/6]}]

Table[sum[n],{n,10}]

(∑_(k=0)^∞)p(5 k+4) (q^k)==((5 ((QPochhammer1[(q^5)])^5))/((QPochhammer1[q])^6))

Sum[PartitionsP[5k+4](q^k),{k,0,∞}]

(∑_(k=0)^∞)p(7 k+5) (q^k)==49q(( ((QPochhammer1[(q^7)])^7))/((QPochhammer1[q])^8))+((7 ((QPochhammer1[(q^7)])^3))/((QPochhammer1[q])^4))

Sum[PartitionsP[7k+5](q^k),{k,0,∞}]

Rademacher Formula

partitionsP[n_,kk_]:=1/Pi/Sqrt[2] Sum[A[k,n]Sqrt[k]((∂_n0)(Sinh[Pi/k Sqrt[2/3(n0-1/24)]]/Sqrt[n0-1/24])) /. n0->n,{k,kk}]

FullSimplify[((∂_n0)(Sinh[Pi/k Sqrt[2/3(n0-1/24)]]/Sqrt[n0-1/24])) /. n0->n]

FullSimplify[Together//@TrigToExp[%]]

((4 (Sqrt[6]) ((Sqrt[-1+24 n]) π Cosh[(((Sqrt[-1+24 n]) π)/(6 k))]-6 k Sinh[(((Sqrt[-1+24 n]) π)/(6 k))]))/(k (((-1+24 n))^(3/2))))//TraditionalForm

Brunier-Ono Formula

EisensteinE[n_Integer?EvenQ,z_,inf_:∞]:=Module[{k,c=(2Pi I)^(n)/(n-1)!/Zeta[n]},
1+c Sum[DivisorSigma[n-1,k]q^(2k),{k,inf}]
]

Eta[z_,inf_:∞]:=(E^((I π z)/12)) QPochhammer[(E^(2 I π z)),(E^(2 I π z))]

F[z_,n_]:=(1/2)(EisensteinE[2,z,n]-2EisensteinE[2,2z,n]-3EisensteinE[2,3z,n]+6EisensteinE[2,6z,n])/(((Eta[z,n])^2)((Eta[2z,n])^2)((Eta[3z,n])^2)((Eta[6z,n])^2))

Series[With[{n=6},F[z,n]],{z,0,3}]

P(n,k):exactlykparts

Examples

ConstrainedIntegerPartitionsP[5,3]

Select[Partitions[5],Length[#]==3&]

Select[Partitions[5],Max[#]==3&]

Table[{Length@Select[Partitions[n],Max[#]==k&],ConstrainedIntegerPartitionsP[n,k]},
{n,10},{k,10}]

Schwennicke

t[k_,n_]:=n+k(k-3)/4

Exact Solution of Difference Equation

P1[n_]:=1
P2[n_]:=If[n≥2,(1/4) (-1+(((-1))^n)+2 n),0]
P3[n_]:=If[n≥3,(1/72) (-7-9 (((-1))^n)+6 (n^2)+16 Cos[((2 n π)/3)]),0]
P4[n_]:=If[n≥4,(1/864) (3 (1+n) (-13+9 (((-1))^n)+2 n (2+n))-96 Cos[((2 n π)/3)]+108 (I^n) Mod[1+n,2]+32 (Sqrt[3]) Sin[((2 n π)/3)]),0]

P(n,2)

{P[n,k]==P[n-1,k-1]+P[n-k,k],P[n,0]==0,P[n,n]==0}/. k->2

Table[P2[n],{n,20}]

Table[Floor[n/2],{n,20}]

Table[Round[t[2,n]/2],{n,20}]

Table[ConstrainedIntegerPartitionsP[n,2],{n,20}]

V5

P1[n_]:=1

RSolve[{P2[n]==P2[n-2]+P1[n-1],P2[2]==1,P2[1]==0},P2[n],n]

V7

P1[n_]:=1

RSolve[{P2[n]==P2[n-2]+P1[n-1],P2[2]==1,P2[1]==0},P2[n],n]

Table[(1/4) (-1+(((-1))^n)+2 n),{n,10}]

P(n,3)

{P[n,k]==P[n-1,k-1]+P[n-k,k]}/. k->3

P1[n_]:=1
P2[n_]:=(1/4) (-1+(((-1))^n)+2 n)

V4.2

RSolve[{P3[n]==P3[n-3]+P2[n-1],P3[3]==1,P3[2]==0,P3[1]==0},P3[n],n]

V7

RSolve[{P3[n]==P3[n-3]+P2[n-1],P3[3]==1,P3[2]==0,P3[1]==0},P3[n],n]

FullSimplify[ExpToTrig[((E^(-(2/3) I (-3+n) π))+(E^((2/3) I (-3+n) π)))]/9+(1/72) (-7-9 (((-1))^n)+6 (n^2)),n∈Integers]

Table[P3[n],{n,20}]

Table[Round[n^2/12],{n,20}]

Table[Round[t[3,n]^2/12],{n,20}]

Table[ConstrainedIntegerPartitionsP[n,3],{n,20}]

P(n,4)

{P[n,k]==P[n-1,k-1]+P[n-k,k]}/. k->4

P1[n_]:=1
P2[n_]:=(1/4) (-1+(((-1))^n)+2 n)
P3[n_]:=(1/72) (-7-9 (((-1))^n)+6 (n^2)+16 Cos[((2 n π)/3)])

FullSimplify[RSolve[{P4[n]==P4[n-4]+P3[n-1],P4[4]==1,P4[3]==0,P4[2]==0,P4[1]==0},P4[n],n]]//Timing

big=-(-36863/(9 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(36866 (((-1))^(1/3)))/(9 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(36863 (((-1))^(2/3)))/(9 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (E^(-((2 I π)/3)-(2/3) I (-4+n) π))-(1/(-1+(((-1))^(1/3))))((5461/(9 (((-1+(((-1))^(1/3))))^5) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(5462 (((-1))^(1/3)))/(9 (((-1+(((-1))^(1/3))))^5) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(5461 (((-1))^(2/3)))/(9 (((-1+(((-1))^(1/3))))^5) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (E^(((2 I π)/3)+(2/3) I (-4+n) π)))+((17+9 (E^(I n π)))/(36-36 I (Sqrt[3])))+(((-1))^(-4+n)) (-184321/(32 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(184319 (((-1))^(1/3)))/(32 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(5760 (((-1))^(2/3)))/((((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (-3+n)+(347520/((((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(33361861 (((-1))^(1/3)))/(96 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(33361979 (((-1))^(2/3)))/(96 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (-3+n)+(1/2) (207360/((((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(1658877 (((-1))^(1/3)))/(8 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(1658883 (((-1))^(2/3)))/(8 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (-3+n) (-2+n)+(1/6) (69120/((((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))-(552959 (((-1))^(1/3)))/(8 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))+(552961 (((-1))^(2/3)))/(8 (((-1+(((-1))^(1/3))))^12) (2-2 (((-1))^(1/3))+(((-1))^(2/3))) (8-11 (((-1))^(1/3))+8 (((-1))^(2/3))) (8-10 (((-1))^(1/3))+9 (((-1))^(2/3))))) (-3+n) (-2+n) (-1+n);

Odd

odd=FullSimplify[ExpToTrig[RootReduce[-(((-1))^(2/3))big]],n∈Integers]

Even

evenpart=FullSimplify[RootReduce[((-(((-1))^(2/3)) (I^(-4+n)))/(8 (2-2 (((-1))^(1/3))+(((-1))^(2/3)))))],n∈Integers]

FactorTerms[odd+evenpart]

P4[n_]:=(1/864) (-39-27 n+18 (n^2)+6 (n^3)-96 Cos[((2 n π)/3)]+27 (1+n)(-1)^n+32 (Sqrt[3]) Sin[((2 n π)/3)])+(-1)^(n/2)Mod[n+1,2]/8

Table[Evaluate[P4[n]],{n,30}]

Table[Round[t[4,n]^3/144-t[4,n]/If[EvenQ[n],48,12]],{n,30}]

Table[ConstrainedIntegerPartitionsP[n,4],{n,30}]

Implementation

IntegerSequences`PartitionsP`

PartitionsP[n] extended to PartitionsP[n,k] in IntegerSequences.m

?PartitionsP

ColumnForm[Table[PartitionsP[n,k],{n,10},{k,n}],Center]

DiscreteMath`IntegerPartitions`ConstrainedIntegerPartitionsP

?ConstrainedIntegerPartitionsP

ColumnForm[Table[ConstrainedIntegerPartitionsP[n,k],{n,10},{k,n}],Center]

Recurrence

partitionsp[n_,k_]:=0 /; k>n;
partitionsp[n_,n_]:=1;
partitionsp[n_,0]:=0;
partitionsp[n_,k_]:=partitionsp[n-1,k-1]+partitionsp[n-k,k];

ColumnForm[Table[partitionsp[n,k],{n,10},{k,n}],Center]

Summatory Function

(1/(1-x))*Product(1/(1-x^m)), m=1..inf

Product[(1/(1-(x^m))),{m,∞}]

FullSimplify[(1/(1-x))(1/(QPochhammer[x,x]))]

Factor[%]

Series[-(1/((-1+x) QPochhammer[x,x])),{x,0,10}]

Table[Sum[PartitionsP[k],{k,0,n}],{n,0,20}]

SeriesCoefficient[-(1/((-1+x) QPochhammer[x,x])),{x,0,n}]

FindLinearRecurrence[{1,2,4,7,12,19,30,45,67,97,139,195,272,373,508,684,915,1212,1597,2087,2714}]