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.

Showing 1-10 of 24 results. Next

A000586 Number of partitions of n into distinct primes.

Original entry on oeis.org

1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 4, 3, 4, 4, 4, 5, 5, 5, 6, 5, 6, 7, 6, 9, 7, 9, 9, 9, 11, 11, 11, 13, 12, 14, 15, 15, 17, 16, 18, 19, 20, 21, 23, 22, 25, 26, 27, 30, 29, 32, 32, 35, 37, 39, 40, 42, 44, 45, 50, 50, 53, 55, 57, 61, 64, 67, 70, 71, 76, 78, 83, 87, 89, 93, 96
Offset: 0

Views

Author

Keywords

Examples

			n=16 has a(16) = 3 partitions into distinct prime parts: 16 = 2+3+11 = 3+13 = 5+11.
		

References

  • H. Gupta, Certain averages connected with partitions. Res. Bull. Panjab Univ. no. 124 1957 427-430.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence in two entries, N0004 and N0039).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000041, A070215, A000607 (parts may repeat), A112022, A000009, A046675, A319264, A319267.

Programs

  • Haskell
    a000586 = p a000040_list where
       p _  0 = 1
       p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m
    -- Reinhard Zumkeller, Aug 05 2012
    
  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
          b(n, i-1)+`if`(ithprime(i)>n, 0, b(n-ithprime(i), i-1))))
        end:
    a:= n-> b(n, numtheory[pi](n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    CoefficientList[Series[Product[(1+x^Prime[k]), {k, 24}], {x, 0, Prime[24]}], x]
    b[n_, i_] := b[n, i] = If[n == 0, 1, If[i < 1, 0, b[n, i-1] + If[Prime[i] > n, 0, b[n - Prime[i], i-1]]]]; a[n_] := b[n, PrimePi[n]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 09 2014, after Alois P. Heinz *)
    nmax = 100; pmax = PrimePi[nmax]; poly = ConstantArray[0, nmax + 1]; poly[[1]] = 1; poly[[2]] = 0; poly[[3]] = 1; Do[p = Prime[k]; Do[poly[[j]] += poly[[j - p]], {j, nmax + 1, p + 1, -1}];, {k, 2, pmax}]; poly (* Vaclav Kotesovec, Sep 20 2018 *)
  • PARI
    a(n,k=n)=if(n<1, !n, my(s);forprime(p=2,k,s+=a(n-p,p-1));s) \\ Charles R Greathouse IV, Nov 20 2012
    
  • Python
    from sympy import isprime, primerange
    from functools import cache
    @cache
    def a(n, k=None):
        if k == None: k = n
        if n < 1: return int(n == 0)
        return sum(a(n-p, p-1) for p in primerange(1, k+1))
    print([a(n) for n in range(83)]) # Michael S. Branicky, Sep 03 2021 after Charles R Greathouse IV

Formula

G.f.: Product_{k>=1} (1+x^prime(k)).
a(n) = A184171(n) + A184172(n). - R. J. Mathar, Jan 10 2011
a(n) = Sum_{k=0..A024936(n)} A219180(n,k). - Alois P. Heinz, Nov 13 2012
log(a(n)) ~ Pi*sqrt(2*n/(3*log(n))) [Roth and Szekeres, 1954]. - Vaclav Kotesovec, Sep 13 2018

Extensions

Entry revised by N. J. A. Sloane, Jun 10 2012

A117278 Triangle read by rows: T(n,k) is the number of partitions of n into k prime parts (n>=2, 1<=k<=floor(n/2)).

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 2, 1, 1, 1, 1, 0, 2, 2, 1, 0, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 0, 2, 1, 3, 2, 1, 1, 0, 1, 3, 2, 3, 2, 1, 0, 2, 2, 3, 3, 2, 1, 1, 1, 0, 4, 3, 3, 3, 2, 1, 0, 2, 2, 4, 3, 4, 2, 1, 1, 1, 1, 3, 4, 5, 3, 3, 2, 1, 0, 2, 2, 6, 4, 4, 4, 2, 1, 1, 0, 1, 5, 3, 6
Offset: 2

Views

Author

Emeric Deutsch, Mar 07 2006

Keywords

Comments

Row n has floor(n/2) terms. Row sums yield A000607. T(n,1) = A010051(n) (the characteristic function of the primes). T(n,2) = A061358(n). Sum(k*T(n,k), k>=1) = A084993(n).

Examples

			T(12,3) = 2 because we have [7,3,2] and [5,5,2].
Triangle starts:
  1;
  1;
  0, 1;
  1, 1;
  0, 1, 1;
  1, 1, 1;
  0, 1, 1, 1;
  0, 1, 2, 1;
  ...
		

Crossrefs

Row sums give A000607.
T(A000040(n),n) gives A259254(n).

Programs

  • Maple
    g:=1/product(1-t*x^(ithprime(j)),j=1..30): gser:=simplify(series(g,x=0,30)): for n from 2 to 22 do P[n]:=sort(coeff(gser,x^n)) od: for n from 2 to 22 do seq(coeff(P[n],t^j),j=1..floor(n/2)) od; # yields sequence in triangular form
    # second Maple program:
    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))[]], 0)))
        end:
    T:= n-> subsop(1=NULL, b(n, numtheory[pi](n)))[]:
    seq(T(n), n=2..25);  # Alois P. Heinz, Nov 16 2012
  • Mathematica
    (* As triangle: *) nn=20;a=Product[1/(1-y x^i),{i,Table[Prime[n],{n,1,nn}]}];Drop[CoefficientList[Series[a,{x,0,nn}],{x,y}],2,1]//Grid (* Geoffrey Critzer, Oct 30 2012 *)
  • PARI
    parts(n, pred)={prod(k=1, n, if(pred(k), 1/(1-y*x^k) + O(x*x^n), 1))}
    {my(n=15); apply(p->Vecrev(p/y), Vec(parts(n, isprime)-1))} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: G(t,x) = -1+1/product(1-tx^(p(j)), j=1..infinity), where p(j) is the j-th prime.

A117929 Number of partitions of n into 2 distinct primes.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 2, 0, 2, 1, 2, 1, 2, 0, 3, 1, 2, 0, 2, 0, 3, 1, 2, 1, 3, 0, 4, 0, 1, 1, 3, 0, 4, 1, 3, 1, 3, 0, 5, 1, 4, 0, 3, 0, 5, 1, 3, 0, 3, 0, 6, 1, 2, 1, 5, 0, 6, 0, 2, 1, 5, 0, 6, 1, 4, 1, 5, 0, 7, 0, 4, 1, 4, 0, 8, 1, 4, 0, 4, 0, 9, 1, 4, 0, 4, 0, 7, 0, 3, 1, 6, 0, 8, 1, 5, 1
Offset: 1

Views

Author

Emeric Deutsch, Apr 03 2006

Keywords

Comments

Number of distinct rectangles with prime length and width such that L + W = n, W < L. For example, a(16) = 2; the two rectangles are 3 X 13 and 5 X 11. - Wesley Ivan Hurt, Oct 29 2017

Examples

			a(24) = 3 because we have [19,5], [17,7] and [13,11].
		

Crossrefs

Cf. A010051, A045917, A061358, A073610, A166081 (positions of 0), A077914 (positions of 2), A080862 (positions of 6).
Column k=2 of A219180. - Alois P. Heinz, Nov 13 2012

Programs

  • Maple
    g:=sum(sum(x^(ithprime(i)+ithprime(j)),i=1..j-1),j=1..35): gser:=series(g,x=0,130): seq(coeff(gser,x,n),n=1..125);
    # alternative
    A117929 := proc(n)
        local a,i,p ;
        a := 0 ;
        p := 2 ;
        for i from 1 do
            if 2*p >= n then
                return a;
            end if;
            if isprime(n-p) then
                a := a+1 ;
            end if;
            p := nextprime(p) ;
        end do:
    end proc:
    seq(A117929(n),n=1..80) ; # R. J. Mathar, Oct 01 2021
  • Mathematica
    l = {}; For[n = 1, n <= 1000, n++, c = 0; For[k = 1, Prime[k] < n/2, k++, If[PrimeQ[n - Prime[k]], c = c + 1] ]; AppendTo[l, c] ] l (* Jake Foster, Oct 27 2008 *)
    Table[Count[IntegerPartitions[n,{2}],?(AllTrue[#,PrimeQ]&&#[[1]]!= #[[2]] &)],{n,120}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Jul 26 2020 *)
  • PARI
    a(n)=my(s);forprime(p=2,(n-1)\2,s+=isprime(n-p));s \\ Charles R Greathouse IV, Feb 26 2014
    
  • Python
    from sympy import sieve
    from collections import Counter
    from itertools import combinations
    def aupton(max):
        sieve.extend(max)
        a = Counter(c[0]+c[1] for c in combinations(sieve._list, 2))
        return [a[n] for n in range(1, max+1)]
    print(aupton(105)) # Michael S. Branicky, Feb 16 2024

Formula

G.f.: Sum_{j>0} Sum_{i=1..j-1} x^(p(i)+p(j)), where p(k) is the k-th prime.
G.f.: A(x)^2/2 - A(x^2)/2 where A(x) = Sum_{p in primes} x^p. - Geoffrey Critzer, Nov 21 2012
a(n) = [x^n*y^2] Product_{i>=1} (1+x^prime(i)*y). - Alois P. Heinz, Nov 22 2012
a(n) = Sum_{i=2..floor((n-1)/2)} A010051(i) * A010051(n-i). - Wesley Ivan Hurt, Oct 29 2017

A219107 Number of compositions (ordered partitions) of n into distinct prime parts.

Original entry on oeis.org

1, 0, 1, 1, 0, 3, 0, 3, 2, 2, 8, 1, 8, 3, 8, 8, 10, 25, 16, 9, 16, 38, 16, 61, 18, 62, 46, 66, 160, 91, 138, 99, 70, 122, 306, 126, 314, 151, 362, 278, 588, 901, 602, 303, 654, 1142, 888, 1759, 892, 1226, 950, 2160, 1230, 3379, 1444, 2372, 2100, 4644, 7416
Offset: 0

Views

Author

Alois P. Heinz, Nov 11 2012

Keywords

Comments

a(0) = 0 iff n in {1,4,6}.

Examples

			a(5) = 3: [2,3], [3,2], [5].
a(7) = 3: [2,5], [5,2], [7].
a(8) = 2: [3,5], [5,3].
a(9) = 2: [2,7], [7,2].
a(10) = 8: [2,3,5], [2,5,3], [3,2,5], [3,5,2], [5,2,3], [5,3,2], [3,7], [7,3].
		

Crossrefs

Programs

  • Maple
    with(numtheory):
    b:= proc(n, i) b(n, i):=
          `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));
          a(n):= add(l[i]*(i-1)!, i=1..nops(l))
        end:
    seq(a(n), n=0..70);
    # second Maple program:
    s:= proc(n) option remember; `if`(n<1, 0, ithprime(n)+s(n-1)) end:
    b:= proc(n, i, t) option remember; `if`(s(i)`if`(p>n, 0, b(n-p, i-1, t+1)))(ithprime(i))+b(n, i-1, t)))
        end:
    a:= n-> b(n, numtheory[pi](n), 0):
    seq(a(n), n=0..70);  # Alois P. Heinz, Jan 30 2020
  • Mathematica
    zip = With[{m=Max[Length[#1], Length[#2]]}, PadRight[#1, m]+PadRight[#2, m] ]&;
    b[n_, i_] := b[n, i] = If[n==0, {1}, If[i<1, {}, b[n, i-1] ~zip~ Join[{0}, If[Prime[i] > n, {}, b[n - Prime[i], i-1]]], {0}]];
    a[n_] := Module[{l}, l = b[n, PrimePi[n]]; Sum[l[[i]]*(i-1)!, {i, 1, Length[l]}]];
    Table[a[n], {n, 0, 70}] (* Jean-François Alcover, Mar 24 2017, adapted from Maple *)

Formula

a(n) = Sum_{k=0..A024936(n)} A219180(n,k)*k!.

A125688 Number of partitions of n into three distinct primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 2, 1, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 2, 4, 3, 4, 2, 5, 3, 5, 4, 6, 1, 6, 3, 6, 4, 6, 3, 9, 3, 8, 5, 8, 4, 11, 3, 11, 5, 10, 3, 13, 3, 13, 6, 12, 2, 14, 5, 15, 6, 13, 2, 18, 5, 17, 6, 14, 4, 21, 5, 19, 7, 17, 4, 25, 4, 20, 8, 21, 4, 26, 4, 25, 9, 22, 4
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 30 2006

Keywords

Comments

a(A124868(n)) = 0; a(A124867(n)) > 0;
a(A125689(n)) = n and a(m) <> n for m < A125689(n).

Examples

			a(42) = #{2+3+37, 2+11+29, 2+17+23} = 3.
		

Crossrefs

Column k=3 of A219180. - Alois P. Heinz, Nov 13 2012

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, [1,0$3], `if`(i<1, [0$4],
           zip((x, y)->x+y, b(n, i-1), [0, `if`(ithprime(i)>n, [0$3],
           b(n-ithprime(i), i-1)[1..3])[]], 0)))
        end:
    a:= n-> b(n, numtheory[pi](n))[4]:
    seq(a(n), n=1..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, {1, 0, 0, 0}, If[i<1, {0, 0, 0, 0}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {0, 0, 0}, Take[b[n-Prime[i], i-1], 3]]]}]]]; a[n_] := b[n, PrimePi[n]][[4]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
    dp3Q[{a_,b_,c_}]:=Length[Union[{a,b,c}]]==3&&AllTrue[{a,b,c},PrimeQ]; Table[ Count[IntegerPartitions[n,{3}],?dp3Q],{n,100}] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale, Jan 30 2019 *)
  • PARI
    a(n)=my(s);forprime(p=n\3,n-4,forprime(q=(n-p)\2+1,min(n-p,p-1),if(isprime(n-p-q),s++)));s \\ Charles R Greathouse IV, Aug 27 2012

Formula

From Alois P. Heinz, Nov 22 2012: (Start)
G.f.: Sum_{0
a(n) = [x^n*y^3] Product_{i>=1} (1+x^prime(i)*y). (End)
a(n) = Sum_{k=1..floor((n-1)/3)} Sum_{i=k+1..floor((n-k-1)/2)} A010051(i) * A010051(k) * A010051(n-i-k). - Wesley Ivan Hurt, Mar 29 2019

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

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

A184172 Number of partitions of n into an odd number of distinct primes.

Original entry on oeis.org

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

Author

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

Keywords

Examples

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

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], i=1..iquo(nops(l), 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]], {i, 1, Quotient[Length[l], 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)) - Vec(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+1). - Alois P. Heinz, Nov 15 2012
a(n) + A184171(n) = A000586(n). - R. J. Mathar, Mar 31 2023

A219199 Number of partitions of n into 5 distinct primes.

Original entry on oeis.org

1, 0, 1, 0, 0, 0, 2, 0, 2, 0, 2, 1, 4, 0, 4, 1, 4, 2, 6, 1, 6, 2, 6, 4, 8, 2, 10, 5, 9, 6, 11, 5, 13, 6, 14, 10, 16, 9, 18, 11, 19, 15, 21, 14, 22, 16, 25, 22, 26, 20, 29, 25, 31, 29, 32, 29, 35, 34, 39, 39, 38, 39, 43, 45, 48, 50, 46, 53, 53, 57, 57, 66, 55
Offset: 28

Author

Alois P. Heinz, Nov 14 2012

Keywords

Crossrefs

Column k=5 of A219180.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, [1,0$5], `if`(i<1, [0$6],
           zip((x, y)->x+y, b(n, i-1), [0, `if`(ithprime(i)>n, [0$5],
           b(n-ithprime(i), i-1)[1..5])[]], 0)))
        end:
    a:= n-> b(n, numtheory[pi](n))[6]:
    seq(a(n), n=28..100);
  • Mathematica
    k = 5; b[n_, i_] := b[n, i] = If[n == 0, Join[{1}, Array[0&, k]], If[i<1, Array[0&, k+1], Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, Array[0&, k], Take[b[n-Prime[i], i-1], k]]]}]]]; a[n_] := b[n, PrimePi[n]][[k+1]]; Table[a[n], {n, 28, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
    Table[Length@Select[IntegerPartitions[k,{5}, Prime@Range@100], #[[1]] > #[[2]] > #[[3]] > #[[4]] > #[[5]] &], {k, 28, 100}] (* Robert Price, Apr 25 2025 *)

Formula

G.f.: Sum_{0
a(n) = [x^n*y^5] Product_{i>=1} (1+x^prime(i)*y).

A024936 a(n) = maximal length of partitions of n into distinct primes or -1 if there is no such partition.

Original entry on oeis.org

0, -1, 1, 1, -1, 2, -1, 2, 2, 2, 3, 1, 3, 2, 3, 3, 3, 4, 3, 3, 3, 4, 3, 4, 3, 4, 4, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 7, 6, 7, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 7, 7, 8, 7, 7, 7, 8, 7, 8, 7, 7, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 8, 8, 9, 8, 7, 8, 8, 8, 9, 8, 9, 8, 9, 8
Offset: 0

Keywords

Examples

			a(12) = 3 because 12 = 2+3+7, but 12 is not a sum of 4 or more distinct primes.
		

Crossrefs

a(n) + 1 = row length of A219180(n).

Programs

  • Mathematica
    ReplaceAll[Table[Max[Length /@ Select[IntegerPartitions[n, n, Prime[Range[n]]],  DuplicateFreeQ[#] &]], {n, 0, 100}] /. -Infinity -> -1] (* Robert Price, Apr 23 2025 *)

Extensions

More terms from Naohiro Nomoto, Oct 28 2001
More terms from David Wasserman, Jan 23 2003
Offset changed and edited by Alois P. Heinz, Nov 13 2012

A219198 Number of partitions of n into 4 distinct primes.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 2, 0, 2, 1, 2, 1, 3, 0, 3, 2, 4, 2, 4, 2, 5, 4, 5, 4, 6, 4, 6, 6, 6, 6, 6, 6, 9, 8, 8, 10, 8, 9, 11, 11, 11, 13, 10, 14, 13, 16, 13, 18, 12, 19, 14, 21, 15, 22, 13, 25, 18, 26, 17, 29, 14, 31, 21, 32, 19, 35, 17, 39, 25, 38, 20, 43, 21, 48, 26
Offset: 17

Author

Alois P. Heinz, Nov 14 2012

Keywords

Crossrefs

Column k=4 of A219180.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, [1,0$4], `if`(i<1, [0$5],
           zip((x, y)->x+y, b(n, i-1), [0, `if`(ithprime(i)>n, [0$4],
           b(n-ithprime(i), i-1)[1..4])[]], 0)))
        end:
    a:= n-> b(n, numtheory[pi](n))[5]:
    seq(a(n), n=17..100);
  • Mathematica
    k = 4; b[n_, i_] := b[n, i] = If[n == 0, Join[{1}, Array[0&, k]], If[i<1, Array[0&, k+1], Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, Array[0&, k], Take[b[n-Prime[i], i-1], k]]]}]]]; a[n_] := b[n, PrimePi[n]][[k+1]]; Table[a[n], {n, 17, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
    Table[Length@Select[IntegerPartitions[k,{4}, Prime@Range@100], #[[1]] > #[[2]] > #[[3]] > #[[4]] &], {k, 17, 100}] (* Robert Price, Apr 25 2025 *)

Formula

G.f.: Sum_{0
a(n) = [x^n*y^4] Product_{i>=1} (1+x^prime(i)*y).
Showing 1-10 of 24 results. Next