OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..5000
EXAMPLE
a(5) = 4: [9], [6,1,1,1], [4,1,1,1,1,1], [1,1,1,1,1,1,1,1,1].
a(6) = 3: [10], [4,4,1,1], [1,1,1,1,1,1,1,1,1,1].
a(7) = 6: [12], [9,1,1,1], [6,4,1,1], [4,4,1,1,1,1], [4,1,1,1,1,1,1,1,1], [1,1,1,1,1,1,1,1,1,1,1,1].
MAPLE
c:= proc(n) option remember; local k; if n=1 then 1 else
for k from 1+c(n-1) while isprime(k) do od; k fi
end:
h:= proc(n) option remember; `if`(isprime(n), h(n-1), n) end:
b:= proc(n, i, c) option remember; `if`(n=0 or i=1, `if`(isprime(
c+n), 0, 1), b(n-i, h(min(n-i, i)), c+1)+b(n, h(i-1), c))
end:
a:= n-> b(c(n)$2, 0):
seq(a(n), n=1..55);
MATHEMATICA
c[n_] := c[n] = Module[{k}, If[n == 1, 1,
For[k = 1+c[n-1], PrimeQ[k], k++]; k]];
h[n_] := h[n] = If[PrimeQ[n], h[n-1], n];
b[n_, i_, c_] := b[n, i, c] = If[n == 0 || i == 1, If[PrimeQ[
c+n], 0, 1], b[n-i, h[Min[n-i, i]], c+1] + b[n, h[i-1], c]];
a[n_] := b[c[n], c[n], 0];
Table[a[n], {n, 1, 55}] (* Jean-François Alcover, Sep 08 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, May 28 2021
STATUS
approved