A155515
Number of partitions of n into as many primes as nonprimes.
Original entry on oeis.org
1, 0, 0, 1, 1, 0, 3, 2, 3, 5, 4, 8, 12, 10, 15, 23, 22, 33, 42, 47, 64, 79, 90, 122, 147, 169, 219, 264, 312, 387, 465, 546, 679, 799, 950, 1151, 1365, 1599, 1937, 2270, 2678, 3181, 3735, 4374, 5192, 6046, 7082, 8318, 9684, 11281, 13208, 15313, 17798, 20702, 23951
Offset: 0
a(9) = #{6+3, 5+4, 5+2+1+1, 4+2+2+1, 2+2+2+1+1+1} = 5;
a(10) = #{8+2, 5+3+1+1, 4+3+2+1, 3+2+2+1+1+1} = 4.
-
b:= proc(n, i, t) local m; m:= n- `if`(t>0, t, -2*t); if m<0 then 0 elif n=0 then 1 elif i<3 then `if`(irem(m,3)=0, 1, 0) else b(n, i, t):= b(n-i, i, t+ `if`(isprime(i), 1, -1)) +b(n, i-1, t) fi end: a:= n-> b(n, n, 0): seq(a(n), n=0..60); # Alois P. Heinz, Apr 30 2009
-
pnpQ[n_]:=Count[n,?PrimeQ]==Length[n]/2; Table[Count[ IntegerPartitions[ n], ?pnpQ],{n,60}] (* Harvey P. Dale, Feb 02 2014 *)
b[n_, i_, t_] := b[n, i, t] = Module[{m}, m = n - If[t > 0, t, -2t]; Which[m < 0, 0, n == 0, 1, i < 3, If[Mod[m, 3] == 0, 1, 0], True, b[n, i, t] = b[n-i, i, t + If[PrimeQ[i], 1, -1]] + b[n, i-1, t]]];
a[n_] := b[n, n, 0];
a /@ Range[0, 60] (* Jean-François Alcover, May 30 2021, after Alois P. Heinz *)
-
parts(n)={1/(prod(k=1, n, 1 - if(isprime(k), y, 1/y)*x^k + O(x*x^n)))}
{my(n=60); apply(p->polcoeff(p,0), Vec(parts(n)))} \\ Andrew Howroyd, Dec 29 2017
-
from sympy import isprime
from sympy.utilities.iterables import partitions
def c(p): return 2*sum(p[i] for i in p if isprime(i)) == sum(p.values())
def a(n): return sum(1 for p in partitions(n) if c(p))
print([a(n) for n in range(55)]) # Michael S. Branicky, Jun 30 2022
A355158
Number of partitions of n that contain more nonprime parts than prime parts.
Original entry on oeis.org
0, 1, 1, 1, 3, 4, 5, 8, 12, 16, 24, 29, 42, 57, 74, 97, 132, 165, 217, 279, 355, 453, 576, 717, 908, 1135, 1408, 1751, 2169, 2664, 3283, 4022, 4909, 5990, 7282, 8814, 10681, 12885, 15506, 18643, 22362, 26739, 31970, 38100, 45340, 53878, 63908, 75639, 89476, 105580, 124445
Offset: 0
For n = 8 the partitions of 8 that contain more nonprime parts than prime parts are [8], [4, 4], [4, 3, 1], [6, 1, 1], [4, 2, 1, 1], [5, 1, 1, 1], [3, 2, 1, 1, 1], [4, 1, 1, 1, 1], [2, 2, 1, 1, 1, 1], [3, 1, 1, 1, 1, 1], [2, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1]. There are 12 of these partitions so a(8) = 12.
-
a(n) = my(nb=0); forpart(p=n, if (#select(x->!isprime(x), Vec(p)) > #p/2, nb++)); nb; \\ Michel Marcus, Jun 25 2022
-
from sympy import isprime
from sympy.utilities.iterables import partitions
def c(p): return 2*sum(p[i] for i in p if not isprime(i)) > sum(p.values())
def a(n): return sum(1 for p in partitions(n) if c(p))
print([a(n) for n in range(51)]) # Michael S. Branicky, Jun 28 2022
A355225
Number of partitions of n that contain more prime parts than nonprime parts.
Original entry on oeis.org
0, 0, 1, 1, 1, 3, 3, 5, 7, 9, 14, 19, 23, 34, 46, 56, 77, 99, 126, 164, 208, 260, 336, 416, 520, 654, 809, 995, 1237, 1514, 1856, 2274, 2761, 3354, 4078, 4918, 5931, 7153, 8572, 10272, 12298, 14663, 17469, 20787, 24643, 29210, 34568, 40797, 48113, 56664, 66573
Offset: 0
For n = 8 the partitions of 8 that contain more prime parts than nonprime parts are [5, 3], [3, 3, 2], [4, 2, 2], [2, 2, 2, 2], [5, 2, 1], [3, 2, 2, 1], [2, 2, 2, 1, 1]. There are seven of these partitions so a(8) = 7.
-
a(n) = my(nb=0); forpart(p=n, if (#select(isprime, Vec(p)) > #p/2, nb++)); nb; \\ Michel Marcus, Jun 25 2022
-
from sympy import isprime
from sympy.utilities.iterables import partitions
def c(p): return 2*sum(p[i] for i in p if isprime(i)) > sum(p.values())
def a(n): return sum(1 for p in partitions(n) if c(p))
print([a(n) for n in range(51)]) # Michael S. Branicky, Jun 28 2022
Showing 1-3 of 3 results.