OFFSET
11,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 11..10000
MAPLE
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)+
`if`(isprime(i), 0, b(n-i, min(n-i, i-1), t-1))))
end:
a:= n-> b(n$2, 3):
seq(a(n), n=11..75); # Alois P. Heinz, Feb 12 2021
MATHEMATICA
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] +
If[PrimeQ[i], 0, b[n - i, Min[n - i, i - 1], t - 1]]]];
a[n_] := b[n, n, 3];
a /@ Range[11, 75] (* Jean-François Alcover, Jul 01 2021, after Alois P. Heinz *)
PROG
(Python)
from functools import lru_cache
from sympy import isprime
@lru_cache(maxsize=None)
def b(n, i, t):
if n == 0: return int(t == 0)
if i < 1 or t < 1: return 0
b2 = 0 if isprime(i) else b(n-i, min(n-i, i-1), t-1)
return b(n, i-1, t) + b2
a = lambda n: b(n, n, 3)
print([a(n) for n in range(11, 76)]) # Michael S. Branicky, Feb 12 2021 after Alois P. Heinz
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Feb 12 2021
STATUS
approved