A344677
Number of partitions of n containing a prime number of primes and an arbitrary number of nonprimes.
Original entry on oeis.org
0, 0, 0, 0, 1, 2, 4, 6, 9, 13, 20, 26, 36, 49, 68, 90, 120, 154, 201, 258, 330, 418, 532, 666, 834, 1041, 1290, 1592, 1958, 2404, 2935, 3588, 4345, 5278, 6366, 7692, 9215, 11096, 13230, 15853, 18831, 22477, 26580, 31620, 37247, 44145, 51851, 61247, 71681, 84445
Offset: 0
a(6) = 4 because there are 4 partitions of 6 that contain a prime number of primes (including repetitions). These partitions are [3,3], [3,2,1], [2,2,2], [2,2,1,1].
-
nterms=50;Table[Total[Map[If[PrimeQ[Count[#, _?PrimeQ]],1,0] &,IntegerPartitions[n]]],{n,0,nterms-1}]
(* Second program: *)
seq[n_] := Module[{p}, p = 1/Product[1 - If[PrimeQ[k], y*x^k, 0] + O[x]^n, {k, 2, n}]; CoefficientList[Sum[If[PrimeQ[k], Coefficient[p, y, k], 0], {k, 2, n}]/QPochhammer[x + O[x]^n]/(p /. y -> 1), x]];
seq[50] (* Jean-François Alcover, May 27 2021, after Andrew Howroyd *)
-
seq(n)={my(p=1/prod(k=2, n, 1 - if(isprime(k), y*x^k) + O(x*x^n))); Vec(sum(k=2, n, if(isprime(k), polcoef(p,k,y)))/eta(x+O(x*x^n))/subst(p,y,1), -(n+1))} \\ Andrew Howroyd, May 26 2021
A344715
Number of partitions of n containing a prime number of distinct primes and an arbitrary number of nonprimes.
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 1, 3, 5, 9, 12, 20, 27, 42, 56, 80, 107, 151, 195, 265, 342, 453, 577, 753, 949, 1220, 1525, 1930, 2398, 3006, 3701, 4594, 5625, 6922, 8426, 10291, 12455, 15117, 18203, 21955, 26326, 31576, 37689, 45002, 53498, 63581, 75313, 89125, 105199, 124056
Offset: 0
a(10) = 12 because there are 12 partitions of 10 that contain a prime number of primes (not counting repetitions). These partitions are [7,3] (containing 2 primes), [7,2,1] (containing 2 primes), [5,3,2] (containing 3 primes), [5,3,1,1] (containing 2 primes), [5,2,2,1] (containing 2 distinct primes), [5,2,1,1,1] (containing 2 primes), [4,3,2,1] (containing 2 primes), [3,3,2,2] (containing 2 distinct primes), [3,3,2,1,1] (containing 2 distinct primes), [3,2,2,2,1] (containing 2 distinct primes), [3,2,2,1,1,1] (containing 2 distinct primes) and [3,2,1,1,1,1,1] (containing 2 primes).
-
b:= proc(n, i) option remember; expand(
`if`(n=0 or i=1, 1, b(n, i-1)+`if`(isprime(i), x, 1)
*add(b(n-i*j, i-1), j=1..n/i)))
end:
a:= n-> (p-> add(`if`(isprime(i), coeff(p, x, i), 0),
i=2..degree(p)))(b(n$2)):
seq(a(n), n=0..49); # Alois P. Heinz, Nov 14 2021
-
nterms=50;Table[Total[Map[If[PrimeQ[Count[#, _?PrimeQ]],1,0] &,Map[DeleteDuplicates[#]&,IntegerPartitions[n],{1}]]],{n,0,nterms-1}]
-
seq(n)={my(p=prod(k=2, n, 1 - y + y/(1 - if(isprime(k), x^k)) + O(x*x^n) ) ); Vec(sum(k=2, n, if(isprime(k), polcoef(p,k,y)))/eta(x+O(x*x^n))/subst(p, y, 1), -(n+1))} \\ Andrew Howroyd, May 27 2021
A344890
Number of partitions of prime(n) containing a prime number of distinct primes and an arbitrary number of nonprimes.
Original entry on oeis.org
0, 0, 1, 3, 20, 42, 151, 265, 753, 3006, 4594, 15117, 31576, 45002, 89125, 235501, 589613, 792426, 1871442, 3251293, 4261819, 9403682, 15690192, 33111688, 86520382, 137957345, 173655404, 273492399, 342231447, 532915031, 2380864800, 3601147053, 6628703864
Offset: 1
a(4) = 3 because there are 3 partitions of prime(4)=7 that contain a prime number of primes (not counting repetitions). These partitions are [5,2] (containing 2 primes), [3,2,2] (containing 2 unique primes) and [3,2,1,1] (containing 2 primes).
-
b:= proc(n, i) option remember; expand(
`if`(n=0 or i=1, 1, b(n, i-1)+`if`(isprime(i), x, 1)
*add(b(n-i*j, i-1), j=1..n/i)))
end:
a:= n-> (p-> add(`if`(isprime(i), coeff(p, x, i), 0),
i=2..degree(p)))(b(ithprime(n)$2)):
seq(a(n), n=1..33); # Alois P. Heinz, Nov 14 2021
-
nterms=22;Table[Total[Map[If[PrimeQ[Count[#, _?PrimeQ]],1,0] &,Map[DeleteDuplicates[#]&,IntegerPartitions[Prime[n]],{1}]]],{n,1,nterms}]
Showing 1-3 of 3 results.