login
A219181
Number of partitions of n into the maximal possible number of distinct prime parts or 0 if there are no such partitions.
2
1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 1, 3, 1, 3, 2, 4, 2, 4, 2, 5, 2, 1, 4, 1, 4, 1, 4, 1, 6, 2, 6, 1, 6, 2, 8, 4, 10, 2, 1, 5, 1, 6, 1, 5, 2, 6, 2, 10, 1, 9, 1, 11, 4, 15, 3, 14, 3, 1, 6, 1, 6, 1, 5, 1, 10, 1, 11
OFFSET
0,19
COMMENTS
a(n) is the last element of row n of triangle A219180 or 0 if the row is empty. a(n) = 0 iff n in {1,4,6}.
LINKS
FORMULA
a(n) = A219180(n,A024936(n)) if A024936(n) >= 0, a(n) = 0 else.
EXAMPLE
a(18) = 2 because there are 2 partitions of 18 into 3 distinct prime parts ([2,3,13], [2,5,11]) but no partitions of 18 into more than 3 distinct prime parts.
MAPLE
with(numtheory):
b:= proc(n, i) option remember;
`if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
[0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
end:
a:= proc(n) local l; l:=b(n, pi(n));
while nops(l)>0 and l[-1]=0 do
l:= subsop(-1=NULL, l)
od;
`if`(nops(l)=0, 0, l[-1])
end:
seq(a(n), n=0..100);
MATHEMATICA
zip = With[{m = Max[Length[#1], Length[#2]]}, PadRight[#1, m] + PadRight[#2, m]]&; b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, zip[b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]]]]; a[n_] := (l = b[n, PrimePi[n]]; While[Length[l]>0 && l[[-1]] == 0, l = ReplacePart[l, -1 -> Nothing]]; If[Length[l] == 0, 0, l[[-1]]]); Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 12 2017, translated from Maple *)
CROSSREFS
Sequence in context: A191613 A298642 A243404 * A347833 A260341 A109969
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Nov 13 2012
STATUS
approved