The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A155515 Number of partitions of n into as many primes as nonprimes. 4
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,7
LINKS
FORMULA
a(n) = A000041(n) - A355306(n). - Omar E. Pol, Jun 30 2022
EXAMPLE
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.
MAPLE
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
MATHEMATICA
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 *)
PROG
(PARI)
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
(Python)
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
CROSSREFS
Sequence in context: A071166 A140358 A130727 * A023605 A223542 A182003
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 23 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 19 11:57 EDT 2024. Contains 372686 sequences. (Running on oeis4.)