login
A341461
Number of partitions of n into 3 distinct nonprime parts.
11
1, 0, 1, 1, 2, 1, 2, 2, 4, 3, 4, 4, 6, 5, 8, 7, 9, 9, 10, 12, 14, 14, 14, 17, 19, 19, 22, 23, 24, 28, 27, 31, 33, 35, 36, 40, 40, 44, 47, 49, 50, 55, 53, 61, 62, 66, 65, 73, 72, 79, 81, 86, 85, 95, 91, 101, 101, 109, 107, 119, 114, 125, 125, 134, 134
OFFSET
11,5
LINKS
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
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Feb 12 2021
STATUS
approved