A331981 Number of compositions (ordered partitions) of n into distinct odd primes.
1, 0, 0, 1, 0, 1, 0, 1, 2, 0, 2, 1, 2, 1, 2, 6, 4, 1, 4, 7, 4, 12, 4, 13, 6, 12, 28, 18, 28, 19, 6, 25, 52, 24, 54, 30, 56, 31, 98, 156, 102, 37, 104, 157, 150, 276, 150, 175, 154, 288, 200, 528, 246, 307, 226, 666, 990, 780, 1038, 679, 348, 799, 1828, 1272, 1162, 1164
Offset: 0
Keywords
Examples
a(16) = 4 because we have [13, 3], [11, 5], [5, 11] and [3, 13].
Links
Programs
-
Maple
s:= proc(n) option remember; `if`(n<1, 0, ithprime(n+1)+s(n-1)) end: b:= proc(n, i, t) option remember; `if`(s(i)
`if`(p>n, 0, b(n-p, i-1, t+1)))(ithprime(i+1))+b(n, i-1, t))) end: a:= n-> b(n, numtheory[pi](n), 0): seq(a(n), n=0..72); # Alois P. Heinz, Feb 03 2020 -
Mathematica
s[n_] := s[n] = If[n < 1, 0, Prime[n + 1] + s[n - 1]]; b[n_, i_, t_] := b[n, i, t] = If[s[i] < n, 0, If[n == 0, t!, If[# > n, 0, b[n - #, i - 1, t + 1]]&[Prime[i + 1]] + b[n, i - 1, t]]]; a[n_] := b[n, PrimePi[n], 0]; a /@ Range[0, 72] (* Jean-François Alcover, Nov 09 2020, after Alois P. Heinz *)