cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A184171 Number of partitions of n into an even number of distinct primes.

Original entry on oeis.org

1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 4, 5, 5, 4, 6, 5, 5, 6, 7, 7, 8, 7, 9, 8, 9, 8, 11, 11, 12, 10, 13, 12, 14, 14, 15, 16, 17, 16, 20, 19, 20, 20, 24, 22, 26, 23, 27, 27, 30, 28, 34, 33, 36, 34, 40, 37, 43, 41, 46, 46, 50, 47, 56, 55
Offset: 0

Views

Author

Emeric Deutsch, (suggested by R. J. Mathar), Jan 09 2011

Keywords

Examples

			a(33) = 5 because we have [31,2], [23,5,3,2], [19,7,5,2], [17,11,3,2], and [13,11,7,2].
		

Crossrefs

Programs

  • Maple
    g := 1/2*(Product(1+z^ithprime(k), k = 1 .. 120)+Product(1-z^ithprime(k), k = 1 .. 120)): gser := series(g, z = 0, 110): seq(coeff(gser, z, n), n = 0 .. 85);
    # second Maple program
    with(numtheory):
    b:= proc(n, i) option remember;
          `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
           [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
        end:
    a:= proc(n) local l; l:= b(n, pi(n));
          add(l[2*i-1], i=1..iquo(nops(l)+1,2))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]}]]]; a[n_] := Module[{l}, l = b[n, PrimePi[n]]; Sum[l[[2*i-1]], {i, 1, Quotient[Length[l]+1, 2]}]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
  • PARI
    parts(n, pred, y)={prod(k=1, n, 1 + if(pred(k), y*x^k + O(x*x^n), 0))}
    {my(n=80); Vec(parts(n, isprime, 1) + parts(n, isprime, -1))/2} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: (1/2)*[Product_{k>=1} (1+z^prime(k)) + Product_{k>=1} (1-z^prime(k))].
a(n) = Sum_{k>=0} A219180(n,2*k). - Alois P. Heinz, Nov 15 2012
a(n) + A184172(n) = A000586(n). - R. J. Mathar, Mar 31 2023