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.

A045450 Number of partitions of n into a prime number of distinct prime parts.

Original entry on oeis.org

1, 0, 1, 1, 1, 2, 0, 2, 1, 2, 2, 3, 0, 4, 2, 4, 3, 4, 2, 5, 3, 5, 3, 5, 3, 6, 5, 5, 5, 7, 5, 9, 5, 7, 8, 8, 6, 11, 8, 11, 9, 12, 10, 14, 11, 15, 12, 15, 13, 18, 17, 17, 16, 18, 18, 23, 20, 22, 23, 25, 23, 30, 26, 28, 29, 32, 32, 36, 34, 38, 38, 41, 41, 47, 45, 47, 48, 50, 54, 58, 57, 60, 63
Offset: 5

Views

Author

Vladeta Jovovic, Jul 21 2003

Keywords

Examples

			a(50) = 15 because there are 15 partitions of 50 into a prime number of distinct prime parts: 2+7+11+13+17 = 2+5+11+13+19 = 2+5+7+17+19 = 2+5+7+13+23 = 2+3+5+17+23 = 2+3+5+11+29 = 2+19+29 = 2+17+31 = 2+11+37 = 2+7+41 = 2+5+43 = 19+31 = 13+37 = 7+43 = 3+47.
		

Crossrefs

Cf. A000586.

Programs

  • Maple
    s:= proc(n) if n<1 then 0 else ithprime(n)+s(n-1) fi end:
    b:= proc(n, i) option remember; expand(`if`(n=0, 1, `if`(s(i) `if`(p>n, 0, x*b(n-p, i-1)))(ithprime(i)))))
        end:
    a:= n-> (p-> add(`if`(isprime(i), coeff(p, x, i), 0)
             , i=2..degree(p)))(b(n, numtheory[pi](n))):
    seq(a(n), n=5..100);  # Alois P. Heinz, Sep 18 2017
  • Mathematica
    partprim[n_] := Module[{sp, spq, sps},
    sp = Subsets[Prime[Range[PrimePi[n]]]];
    spq = Select[sp, PrimeQ@Length@# &];
    sps = Select[spq, n == Plus@@# &];
    sps // Length // Return];
    Table[partprim[n], {n, 5, 80}] (* Andres Cicuttin, Sep 17 2017 *)
    s[n_] := s[n] = If [n < 1, 0, Prime[n] + s[n - 1]];
    b[n_, i_] := b[n, i] = Expand[If[n == 0, 1, If[s[i] < n, 0, b[n, i - 1] + Function[p, If[p > n, 0, x*b[n - p, i - 1]]][Prime[i]]]]];
    a[n_] := Function[p, Sum[If[PrimeQ[i], Coefficient[p, x, i], 0], {i, 2, Exponent[p, x]}]][b[n, PrimePi[n]]];
    Table[a[n], {n, 5, 100}] (* Jean-François Alcover, Jun 11 2021, after Alois P. Heinz *)
    Table[Count[IntegerPartitions[n],?(AllTrue[#,PrimeQ]&&Length[#]==Length[ Union[ #]] && PrimeQ[Length[#]]&)],{n,5,90}] (* _Harvey P. Dale, May 17 2024 *)