OFFSET
1,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..100
MAPLE
with(numtheory):
b:= proc(n, i, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
`if`(i<1 or t<1, 0, b(n, i-1, t) +(p-> `if`(p>n, 0,
b(n-p, i, t-1)))(ithprime(i))))
end:
a:= n-> b(n^2, pi(n^2), 4):
seq(a(n), n=1..40); # Alois P. Heinz, Jun 15 2014
MATHEMATICA
$RecursionLimit = 1000; b[n_, i_, t_] := b[n, i, t] = If[n == 0, If[t == 0, 1, 0], If[i < 1 || t < 1, 0, b[n, i - 1, t] + Function[{p}, If[p > n, 0, b[n - p, i, t - 1]]][Prime[i]]]]; a[n_] := b[n^2, PrimePi[n^2], 4]; Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Apr 15 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Olivier Gérard, Jun 15 2014
STATUS
approved