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.

Previous Showing 11-20 of 52 results. Next

A259194 Number of partitions of n into four primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 2, 3, 3, 4, 4, 6, 3, 6, 5, 7, 5, 9, 5, 11, 7, 11, 7, 13, 6, 14, 9, 15, 8, 18, 9, 21, 10, 19, 11, 24, 10, 26, 12, 26, 13, 30, 12, 34, 15, 33, 16, 38, 14, 41, 17, 41, 16, 45, 16, 50, 19, 47, 21, 56, 20, 61, 20, 57
Offset: 0

Views

Author

Doug Bell, Jun 20 2015

Keywords

Examples

			a(17) = 3 because 17 can be written as the sum of four primes in exactly three ways: 2+2+2+11, 2+3+5+7 and 2+5+5+5.
		

Crossrefs

Column k=4 of A117278.
Number of partitions of n into r primes for r = 1..10: A010051, A061358, A068307, this sequence, A259195, A259196, A259197, A259198, A259200, A259201.
Cf. A000040.

Programs

Formula

a(n) = Sum_{k=1..floor(n/4)} Sum_{j=k..floor((n-k)/3)} Sum_{i=j..floor((n-j-k)/2)} A010051(i) * A010051(j) * A010051(k) * A010051(n-i-j-k). - Wesley Ivan Hurt, Apr 17 2019
a(n) = [x^n y^4] Product_{k>=1} 1/(1 - y*x^prime(k)). - Ilya Gutkovskiy, Apr 18 2019

A051034 Minimal number of primes needed to sum to n.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2
Offset: 2

Views

Author

Keywords

Examples

			a(2) = 1 because 2 is already prime.
a(4) = 2 because 4 = 2+2 is a partition of 4 into 2 prime parts and there is no such partition with fewer terms.
a(27) = 3 because 27 = 3+5+19 is a partition of 27 into 3 prime parts and there is no such partition with fewer terms.
		

Crossrefs

Programs

  • Mathematica
    (* Assuming Goldbach's conjecture *) a[p_?PrimeQ] = 1; a[n_] := If[ Reduce[ n == x + y, {x, y}, Primes] === False, 3, 2]; Table[a[n], {n, 2, 112}] (* Jean-François Alcover, Apr 03 2012 *)
  • PARI
    issum(n,k)=if(k==1,isprime(n),k--;forprime(p=2,n,if(issum(n-p,k),return(1)));0)
    a(n)=my(k);while(!issum(n,k++),);k \\ Charles R Greathouse IV, Jun 01 2011

Formula

a(n) = 1 iff n is prime. a(2n) = 2 (for n > 1) if Goldbach's conjecture is true. a(2n+1) = 2 (for n >= 1) if 2n+1 is not prime, but 2n-1 is. a(2n+1) >= 3 (for n >= 1) if both 2n+1 and 2n-1 are not primes (for sufficiently large n, a(2n+1) = 3 by Vinogradov's theorem, 1937). - Franz Vrabec, Nov 30 2004
a(n) <= 3 for all n, assuming the Goldbach conjecture. - N. J. A. Sloane, Jan 20 2007
a(2n+1) <= 5, see Tao 2012. - Charles R Greathouse IV, Jul 09 2012
Assuming Goldbach's conjecture, a(n) <= 3. In particular, a(p)=1; a(2*n)=2 for n>1; a(p+2)=2 provided p+2 is not prime; otherwise a(n)=3. - Sean A. Irvine, Jul 29 2019
a(2n+1) <= 3 by Helfgott's proof of Goldbach's ternary conjecture, and hence a(n) <= 4 in general. - Charles R Greathouse IV, Oct 24 2022

Extensions

More terms from Naohiro Nomoto, Mar 16 2001

A259195 Number of partitions of n into five primes.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 5, 4, 6, 6, 7, 6, 10, 7, 11, 9, 12, 11, 17, 11, 18, 13, 20, 14, 24, 15, 27, 18, 29, 21, 35, 19, 38, 24, 41, 26, 47, 26, 53, 30, 54, 34, 64, 33, 70, 38, 73, 41, 81, 41, 89, 45, 92, 50, 103, 47, 112, 56, 117, 61, 127, 57
Offset: 0

Views

Author

Doug Bell, Jun 20 2015

Keywords

Examples

			a(17) = 3 because 17 can be written as the sum of five primes in exactly three ways: 2+2+3+3+7, 2+2+3+5+5, and 3+3+3+3+5.
		

Crossrefs

Column k=5 of A117278.
Number of partitions of n into r primes for r = 1..10: A010051, A061358, A068307, A259194, this sequence, A259196, A259197, A259198, A259200, A259201.
Cf. A000040.

Programs

Formula

a(n) = Sum_{l=1..floor(n/5)} Sum_{k=l..floor((n-l)/4)} Sum_{j=k..floor((n-k-l)/3)} Sum_{i=j..floor((n-j-k-l)/2)} c(i) * c(j) * c(k) * c(l) * c(n-i-j-k-l), where c = A010051. - Wesley Ivan Hurt, Apr 17 2019
a(n) = [x^n y^5] Product_{k>=1} 1/(1 - y*x^prime(k)). - Ilya Gutkovskiy, Apr 18 2019

Extensions

More terms from David A. Corneth, Sep 06 2020

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

A230219 Number of ways to write 2*n + 1 = p + q + r with p <= q such that p, q, r are primes in A230217 and p + q + 9 is also prime.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 1, 2, 5, 2, 2, 4, 3, 1, 4, 3, 1, 4, 1, 2, 5, 2, 3, 4, 3, 3, 8, 6, 3, 12, 6, 2, 13, 3, 3, 7, 6, 4, 5, 4, 4, 8, 7, 4, 12, 7, 3, 19, 6, 3, 16, 5, 4, 9, 5, 5, 7, 10, 4, 5, 8, 3, 14, 4, 3, 14, 2, 5, 12, 5, 2, 14, 9, 2, 10, 12, 4, 12, 7, 6, 12, 7, 9, 14, 8, 6, 12, 5, 4, 19, 8, 4, 23, 6, 3, 14
Offset: 1

Author

Zhi-Wei Sun, Oct 11 2013

Keywords

Comments

Conjecture: a(n) > 0 for all n > 6.
This implies Goldbach's weak conjecture for odd numbers and also Goldbach's conjecture for even numbers.
The conjecture also implies that there are infinitely many primes in A230217.

Examples

			a(18) = 1 since 2*18 + 1 = 7 + 13 + 17, and 7, 13, 17 are terms of A230217, and 7 + 13 + 9 = 29 is a prime.
		

Crossrefs

Programs

  • Mathematica
    RQ[n_]:=PrimeQ[n+6]&&PrimeQ[3n+8]
    SQ[n_]:=PrimeQ[n]&&RQ[n]
    a[n_]:=Sum[If[RQ[Prime[i]]&&RQ[Prime[j]]&&PrimeQ[Prime[i]+Prime[j]+9]&&SQ[2n+1-Prime[i]-Prime[j]],1,0],{i,1,PrimePi[n-1]},{j,i,PrimePi[2n-2-Prime[i]]}]
    Table[a[n],{n,1,100}]

A007963 Number of (unordered) ways of writing 2n+1 as a sum of 3 odd primes.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 7, 6, 8, 7, 9, 10, 10, 10, 11, 12, 12, 14, 16, 14, 16, 16, 16, 18, 20, 20, 20, 21, 21, 21, 27, 24, 25, 28, 27, 28, 33, 29, 32, 35, 34, 30, 37, 36, 34, 42, 38, 36, 46, 42, 42, 50, 46, 47, 53, 50, 45, 56, 54, 46, 62, 53, 48, 64, 59, 55, 68, 61, 59, 68
Offset: 0

Author

R. Muller

Keywords

Comments

Ways of writing 2n+1 as p+q+r where p,q,r are odd primes with p <= q <= r.
The two papers of Helfgott appear to provide a proof of the Odd Goldbach Conjecture that every odd number greater than five is the sum of three primes. (The paper is still being reviewed.) - Peter Luschny, May 18 2013; N. J. A. Sloane, May 19 2013

Examples

			a(10) = 4 because 21 = 3+5+13 = 3+7+11 = 5+5+11 = 7+7+7.
		

References

  • George E. Andrews, Number Theory (NY, Dover, 1994), page 111.
  • Ivars Peterson, The Mathematical Tourist (NY, W. H. Freeman, 1998), pages 35-37.
  • Paulo Ribenboim, "VI, Goldbach's famous conjecture," The New Book of Prime Number Records, 3rd ed. (NY, Springer, 1996), pages 291-299.

Crossrefs

Cf. A068307, A087916, A294294 (lower bound of scatterplot), A294357, A294358 (records).

Programs

  • Maple
    A007963 := proc(n)
        local a,i,j,k,p,q,r ;
        a := 0 ;
        for i from 2 do
            p := ithprime(i) ;
            for j from i do
                q := ithprime(j) ;
                for k from j do
                    r := ithprime(k) ;
                    if p+q+r = 2*n+1 then
                        a := a+1 ;
                    elif p+q+r > 2*n+1 then
                        break;
                    end if;
                end do:
                if p+2*q > 2*n+1 then
                    break;
                end if;
            end do:
            if 3*p > 2*n+1 then
                break;
            end if;
        end do:
        return a;
    end proc:
    seq(A007963(n),n=0..30) ; # R. J. Mathar, Sep 06 2014
  • Mathematica
    nn = 75; ps = Prime[Range[2, nn + 1]]; c = Flatten[Table[If[i >= j >= k, i + j + k, 0], {i, ps}, {j, ps}, {k, ps}]]; Join[{0, 0, 0, 0}, Transpose[Take[Rest[Sort[Tally[c]]], nn+2]][[2]]] (* T. D. Noe, Apr 08 2014 *)
  • PARI
    a(n)=my(k=2*n+1,s,t); forprime(p=(k+2)\3,k-6, t=k-p; forprime(q=t\2,min(t-3,p), if(isprime(t-q), s++))); s \\ Charles R Greathouse IV, Mar 20 2017
  • Perl
    use ntheory ":all"; sub a007963 { my($n,$c)=(shift,0); forpart { $c++ if vecall { is_prime($) } @; } $n,{n=>3,amin=>3}; $c; }
    say "$ ",a007963(2*$+1) for 0..100; # Dana Jacobsen, Mar 19 2017
    
  • Sage
    def A007963(n):
        c = 0
        for p in Partitions(n, length = 3):
            b = True
            for t in p:
                b = is_prime(t) and t > 2
                if not b: break
            if b : c = c + 1
        return c
    [A007963(2*n+1) for n in (0..77)]   # Peter Luschny, May 18 2013
    

Extensions

Corrected and extended by David W. Wilson

A071335 Number of partitions of n into sum of at most three primes.

Original entry on oeis.org

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

Author

Reinhard Zumkeller, May 19 2002

Keywords

Comments

a(n) = A010051(n) + A061358(n) + A068307(n). [From Reinhard Zumkeller, Aug 08 2009]

Examples

			a(21)=6 as 21 = 2+19 = 2+2+17 = 3+5+13 = 3+7+11 = 5+5+11 = 7+7+7.
		

Crossrefs

Programs

  • Mathematica
    goldbachcount[p1_] := (parts=IntegerPartitions[p1, 3]; count=0; n=1;
      While[n<=Length[parts], If[Intersection[Flatten[PrimeQ[parts[[n]]]]][[1]]==True, count++]; n++]; count); Table[goldbachcount[i], {i, 1, 100}] (* Frank M Jackson, Mar 25 2013 *)
    Table[Length[Select[IntegerPartitions[n,3],AllTrue[#,PrimeQ]&]],{n,90}] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 21 2016 *)

A124867 Numbers that are the sum of 3 distinct primes.

Original entry on oeis.org

10, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81
Offset: 1

Author

Alexander Adamchuk, Nov 11 2006

Keywords

Comments

(Conjecture) Every number n > 17 is the sum of 3 distinct primes. Natural numbers that are not the sum of 3 distinct primes are listed in A124868.
A125688(a(n)) > 0. - Reinhard Zumkeller, Nov 30 2006

Examples

			The first three primes are 2, 3, 5, and 2 + 3 + 5 = 10, so 10 is in the sequence. No smaller integer is in the sequence.
5 + 5 + 5 = 15, but note also 3 + 5 + 7 = 15, so 15 is in the sequence.
Although 13 = 3 + 3 + 7 = 3 + 5 + 5, both of those repeat primes, so 13 is not in the sequence.
		

Crossrefs

Cf. A124868 (not the sum of 3 distinct primes), A068307, A125688.

Programs

  • Mathematica
    threePrimes[n_] := Module[{p, q, r}, {p, q, r} /. Solve[n == p + q + r && p < q < r, {p, q, r}, Primes]];
    Reap[For[n = 10, n <= 100, n++, sol = threePrimes[n]; If[MatchQ[sol, {{, , }..}], Print[n, " ", sol[[1]]]; Sow[n]]]][[2, 1]] (* _Jean-François Alcover, Apr 26 2020 *)
    has3DistPrimesPart[n_] := Length[Select[IntegerPartitions[n, {3}], Length[Union[#]] == 3 && Union[PrimeQ[#]] == {True} &]] > 0; Select[Range[100], has3DistPrimesPart] (* Alonso del Arte, Apr 26 2020 *)
    Union[Total/@Subsets[Prime[Range[20]],{3}]] (* Harvey P. Dale, Feb 06 2024 *)
  • PARI
    a(n)=if(n>5,n+12,[10, 12, 14, 15, 16][n]) \\ Charles R Greathouse IV, Aug 26 2011

A283762 Expansion of (x + Sum_{k>=1} x^prime(k))^3.

Original entry on oeis.org

0, 0, 0, 1, 3, 6, 7, 9, 9, 13, 12, 15, 9, 15, 12, 22, 15, 24, 12, 27, 18, 34, 18, 36, 15, 42, 24, 45, 15, 42, 12, 51, 24, 52, 18, 60, 21, 66, 24, 58, 15, 69, 18, 75, 30, 75, 24, 87, 21, 93, 36, 91, 24, 99, 18, 108, 36, 97, 18, 108, 21, 126, 42, 111, 21, 135, 30, 141, 36, 112, 18, 150, 30, 153, 42, 138, 33, 177, 30, 171, 42
Offset: 0

Author

Ilya Gutkovskiy, Mar 16 2017

Keywords

Comments

Number of ways to write n as an ordered sum of 3 noncomposite numbers (1 together with the primes) (A008578).
a(2k+1) > 0 for all k > 0 (from the ternary Goldbach's conjecture, proved by H. A. Helfgott).

Examples

			a(6) = 7 because we have [3, 2, 1], [3, 1, 2], [2, 3, 1], [2, 2, 2], [2, 1, 3], [1, 3, 2] and [1, 2, 3].
		

Crossrefs

Programs

  • Mathematica
    nmax = 80; CoefficientList[Series[(x + Sum[x^Prime[k], {k, 1, nmax}])^3, {x, 0, nmax}], x]
  • PARI
    concat([0, 0, 0], Vec((x + sum(k=1, 80, x^prime(k)))^3 + O(x^81))) \\ Indranil Ghosh, Mar 16 2017

Formula

G.f.: (x + Sum_{k>=1} x^prime(k))^3.

A341946 Number of partitions of n into 3 primes (counting 1 as a prime).

Original entry on oeis.org

1, 1, 2, 2, 3, 2, 4, 2, 4, 2, 4, 2, 6, 3, 6, 2, 6, 3, 8, 3, 8, 3, 9, 4, 10, 3, 9, 2, 10, 4, 12, 3, 12, 4, 13, 4, 13, 3, 14, 3, 15, 5, 16, 4, 17, 4, 18, 6, 19, 4, 19, 3, 20, 6, 20, 3, 20, 4, 23, 7, 23, 4, 26, 5, 26, 6, 23, 3, 27, 5, 28, 7, 28, 6, 33, 5, 31, 7, 30, 5, 34
Offset: 3

Author

Ilya Gutkovskiy, Feb 24 2021

Keywords

Programs

  • Maple
    b:= proc(n, i) option remember; series(`if`(n=0, 1,
         `if`(i<0, 0, (p-> `if`(p>n, 0, x*b(n-p, i)))(
         `if`(i=0, 1, ithprime(i)))+b(n, i-1))), x, 4)
        end:
    a:= n-> coeff(b(n, numtheory[pi](n)), x, 3):
    seq(a(n), n=3..83);  # Alois P. Heinz, Feb 24 2021
  • Mathematica
    b[n_, i_] := b[n, i] = Series[If[n == 0, 1,
         If[i < 0, 0, Function[p, If[p > n, 0, x*b[n - p, i]]][
         If[i == 0, 1, Prime[i]]] + b[n, i-1]]], {x, 0, 4}];
    a[n_] := Coefficient[b[n, PrimePi[n]], x, 3];
    Table[a[n], {n, 3, 83}] (* Jean-François Alcover, Feb 14 2022, after Alois P. Heinz *)
Previous Showing 11-20 of 52 results. Next