OFFSET
1,5
COMMENTS
2 = prime(1) is the only prime number which is not expressible as the sum of distinct smaller noncomposites, i.e. there exists only one zero in the sequence.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
a(8) = 6: prime(8) = 19 can be expressed as the sum of distinct smaller noncomposites in 6 different ways: 17+2 = 13+5+1 = 13+3+2+1 = 11+7+1 = 11+5+3 = 11+5+2+1.
MAPLE
s:= proc(n) s(n):= `if`(n<1, n+1, s(n-1) +ithprime(n)) end:
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i=0,
`if`(n=1, 1, 0), `if`(n>s(i), 0, b(n, i-1)+
`if`(ithprime(i)>n, 0, b(n-ithprime(i), i-1)))))
end:
a:= n-> b(ithprime(n), n-1):
seq (a(n), n=1..80); # Alois P. Heinz, Aug 29 2012
MATHEMATICA
s[n_] := If[n < 1, n + 1, s[n - 1] + Prime[n]];
b[n_, i_] := b[n, i] = If[n == 0, 1, If[i == 0, If[n == 1, 1, 0], If[n > s[i], 0, b[n, i - 1] + If[Prime[i] > n, 0, b[n - Prime[i], i - 1]]]]];
a[n_] := b[Prime[n], n - 1];
Array[a, 80] (* Jean-François Alcover, Nov 22 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Syed Iddi Hasan, Aug 29 2012
EXTENSIONS
More terms from Alois P. Heinz, Aug 29 2012
STATUS
approved