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
Alois P. Heinz, Table of n, a(n) for n = 0..3500
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
KEYWORD
nonn,look
AUTHOR
Alois P. Heinz, Nov 13 2012
STATUS
approved