A339433 Number of compositions (ordered partitions) of n into an odd number of distinct primes.
0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 6, 1, 6, 1, 6, 6, 6, 1, 12, 7, 12, 12, 12, 13, 12, 12, 18, 18, 132, 19, 132, 25, 18, 24, 252, 30, 258, 31, 264, 156, 486, 37, 498, 157, 504, 276, 738, 175, 738, 288, 750, 528, 984, 307, 1218, 666, 1110, 780, 6378, 679, 6618, 799, 1716, 1272
Offset: 0
Keywords
Examples
a(10) = 6 because we have [5, 3, 2], [5, 2, 3], [3, 5, 2], [3, 2, 5], [2, 5, 3] and [2, 3, 5].
Links
Programs
-
Maple
b:= proc(n, i, p) option remember; `if`(n=0, irem(p, 2)*p!, (s-> `if`(s>n, 0, b(n, i+1, p)+b(n-s, i+1, p+1)))(ithprime(i))) end: a:= n-> b(n, 1, 0): seq(a(n), n=0..70); # Alois P. Heinz, Dec 04 2020
-
Mathematica
b[n_, i_, p_] := b[n, i, p] = If[n == 0, Mod[p, 2]*p!, Function[s, If[s > n, 0, b[n, i + 1, p] + b[n - s, i + 1, p + 1]]][Prime[i]]]; a[n_] := b[n, 1, 0]; Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Feb 26 2022, after Alois P. Heinz *)