A347744 Number of compositions (ordered partitions) of n into at most 2 prime parts (counting 1 as a prime).
1, 1, 2, 3, 3, 3, 3, 3, 4, 2, 3, 1, 4, 3, 5, 2, 4, 1, 6, 3, 6, 2, 5, 1, 8, 2, 5, 0, 4, 1, 8, 3, 6, 2, 7, 0, 8, 1, 5, 2, 6, 1, 10, 3, 8, 2, 7, 1, 12, 2, 8, 0, 6, 1, 12, 2, 6, 0, 7, 1, 14, 3, 7, 2, 10, 0, 12, 1, 6, 2, 10, 1, 14, 3, 11, 2, 10, 0, 14, 1, 10
Offset: 0
Keywords
Programs
-
Mathematica
Table[Length@Flatten[Permutations/@IntegerPartitions[n,2,Join[{1},Prime@Range@PrimePi@n]],1],{n,0,80}] (* Giorgos Kalogeropoulos, Sep 12 2021 *)
-
PARI
{ a(n) = local(s(n) = if(n<2,1,isprime(n))); if(n==0,1,sum(i=1,n,s(i)*s(n-i))); } \\ Christian Krause, Dec 06 2022