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 22 results. Next

A002375 From Goldbach conjecture: number of decompositions of 2n into an unordered sum of two odd primes.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A weaker form of this conjecture, the ternary form, was proved by Helfgott (see link below). - T. D. Noe, May 14 2013
The Goldbach conjecture is that for n >= 3, this sequence is always positive.
This has been checked up to at least 10^18 (see A002372).
With the exception of the n=2 term, identical to A045917.
The conjecture has been verified up to 3 * 10^17 (see MathWorld link). - Dmitry Kamenetsky, Oct 17 2008
Languasco and Zaccagnini proved that, where Lambda is the von Mangoldt function, and R(n) = Sum_{i + j = n} Lambda(i)*Lambda(j) is the counting function for the Goldbach numbers, and for N >= 2 and assume the Riemann hypothesis (RH) holds, then Sum_{n = 1..N} R(n) = (N^2)/2 - 2*Sum_{rho} ((N^(rho+1))/(rho*(rho+1))) + O(N * log^3 N).
If 2n is the sum of two distinct primes, then neither prime divides 2n. - Christopher Heiling, Feb 28 2017

Examples

			2 and 4 are not the sum of 2 odd primes, so a(1) = a(2) = 0; 6 = 3 + 3 (one way, so a(3) = 1); 8 = 3 + 5 (so a(4) = 1); 10 = 3 + 7 = 5 + 5 (so a(5) = 2); etc.
		

References

  • Calvin C. Clawson, "Mathematical Mysteries, the beauty and magic of numbers," Perseus Books, Cambridge, MA, 1996, Chapter 12, Pages 236-257.
  • Apostolos K. Doxiadis, Uncle Petros and Goldbach's Conjecture, Bloomsbury Pub. PLC USA, 2000.
  • D. A. Grave, Traktat z Algebrichnogo Analizu (Monograph on Algebraic Analysis). Vol. 2, p. 19. Vidavnitstvo Akademiia Nauk, Kiev, 1938.
  • H. Halberstam and H. E. Richert, 1974, "Sieve methods", Academic press, London, New York, San Francisco.
  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 80.
  • N. V. Maslova, On the coincidence of Grünberg-Kegel graphs of a finite simple group and its proper subgroup, Proceedings of the Steklov Institute of Mathematics April 2015, Volume 288, Supplement 1, pp 129-141; Original Russian Text: Trudy Instituta Matematiki i Mekhaniki UrO RAN, 2014, Vol. 20, No. 1.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See also A061358. Cf. A002372 (ordered sums), A002373, A002374, A045917.
A023036 is (essentially) the first appearance of n and A000954 is the last (assumed) appearance of n.
Cf. A065091, A010051, A001031 (a weaker form of the conjecture).

Programs

  • Haskell
    a002375 n = sum $ map (a010051 . (2 * n -)) $ takeWhile (<= n) a065091_list
    -- Reinhard Zumkeller, Sep 02 2013
    
  • Magma
    A002375 := func; [A002375(n):n in[1..98]];
    
  • Maple
    A002375 := proc(n) local s, p; s := 0; p := 3; while p<2*n do s := s+x^p; p := nextprime(p) od; (coeff(s^2, x, 2*n)+coeff(s,x,n))/2 end; [seq(A002375(n), n=1..100)];
    a:=proc(n) local c,k; c:=0: for k from 1 to floor((n-1)/2) do if isprime(2*k+1)=true and isprime(2*n-2*k-1)=true then c:=c+1 else c:=c fi od end: A:=[0,0,seq(a(n),n=3..98)]; # Emeric Deutsch, Aug 27 2007
    g:=sum(sum(x^(ithprime(i)+ithprime(j)),i=2..j),j=2..50): seq(coeff(g,x,2*n), n =1..98); # Emeric Deutsch, Aug 27 2007
  • Mathematica
    f[n_] := Length[ Select[2n - Prime[ Range[2, PrimePi[n]]], PrimeQ]]; Table[ f[n], {n, 100}] (* Paul Abbott, Jan 11 2005 *)
    nn = 10^2; ps = Boole[PrimeQ[Range[1,2*nn,2]]]; Table[Sum[ps[[i]] ps[[n-i+1]], {i, Ceiling[n/2]}], {n, nn}] (* T. D. Noe, Apr 13 2011 *)
    Table[Count[IntegerPartitions[2n,{2}],?(AllTrue[#,PrimeQ]&&FreeQ[#,2]&)],{n,100}] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale, Mar 01 2018 *)
    j[n_] := If[PrimeQ[2 n - 1], 2 n - 1, 0]; A085090 = Array[j, 98];
    r[n_] := Table[A085090[[k]] + A085090[[n - k + 1]], {k, 1, n}];
    countzeros[l_List] := Sum[KroneckerDelta[0, k], {k, l}];
    Table[((x = n - 2 countzeros[A085090[[1 ;; n]]] + countzeros[r[n]]) +
    KroneckerDelta[OddQ[x], True])/2, {n, 1, 98}] (* Fred Daniel Kline, Aug 30 2018 *)
  • MuPAD
    A002375 := proc(n) local s,p; begin s := 0; p := 3; repeat if isprime(2*n-p) then s := s+1 end_if; p := nextprime(p+2); until p>n end_repeat; s end_proc:
    
  • PARI
    A002375(n)=sum(i=2,primepi(n),isprime(2*n-prime(i))) /* ...i=1... gives A045917 */
    
  • PARI
    apply( {A002375(n,s=0,N=2*n)=forprime(p=n, N-3, isprime(N-p)&&s++);s}, [1..100]) \\ M. F. Hasler, Jan 03 2023
    
  • Python
    from sympy import primerange, isprime
    def A002375(n): return sum(1 for p in primerange(3,n+1) if isprime((n<<1)-p)) # Chai Wah Wu, Feb 20 2025
  • Sage
    def A002375(n):
        P = primes(3, n+1)
        M = (2*n - p for p in P)
        F = [k for k in M if is_prime(k)]
        return len(F)
    [A002375(n) for n in (1..98)] # Peter Luschny, May 19 2013
    

Formula

From Halberstam and Richert: a(n) < (8+0(1))*c(n)*n/log(n)^2 where c(n) = Product_{p > 2} (1-1/(p-1)^2)*Product_{p|n, p > 2} (p-1)/(p-2). It is conjectured that the factor 8 can be replaced by 2. Is a(n) > n/log(n)^2 for n large enough? - Benoit Cloitre, May 20 2002
a(n) = ceiling(A002372(n)/2). - Emeric Deutsch, Jul 14 2004
G.f.: Sum_{j>=2} Sum_{i=2..j} x^(p(i) + p(j)), where p(k) is the k-th prime. - Emeric Deutsch, Aug 27 2007
Not very efficient: a(n) = (Sum_{i=1..n} (pi(i) - pi(i-1)) * (pi(2n-i) - pi(2n-i-1))) - floor(2/n)*floor(n/2). - Wesley Ivan Hurt, Jan 06 2013
For n >= 2, a(n) = Sum_{3 <= p <= n, p is prime} A(2*n - p) - binomial(A(n), 2) - a(n-1) - a(n-2) - ... - a(1), where A(n) = A033270(n) (see Example 1 in link of V. Shevelev). - Vladimir Shevelev, Jul 08 2013

Extensions

Beginning corrected by Paul Zimmermann, Mar 15 1996
More terms from James Sellers
Edited by Charles R Greathouse IV, Apr 20 2010

A002372 Goldbach conjecture: number of decompositions of 2n into ordered sums of two odd primes.

Original entry on oeis.org

0, 0, 1, 2, 3, 2, 3, 4, 4, 4, 5, 6, 5, 4, 6, 4, 7, 8, 3, 6, 8, 6, 7, 10, 8, 6, 10, 6, 7, 12, 5, 10, 12, 4, 10, 12, 9, 10, 14, 8, 9, 16, 9, 8, 18, 8, 9, 14, 6, 12, 16, 10, 11, 16, 12, 14, 20, 12, 11, 24, 7, 10, 20, 6, 14, 18, 11, 10, 16, 14, 15, 22, 11, 10, 24, 8, 16, 22, 9, 16, 20, 10
Offset: 1

Views

Author

Keywords

Comments

The weak form of this conjecture was proved by Helfgott (see link below). - T. D. Noe, May 14 2013
Goldbach conjectured in 1742 that for n >= 3, this sequence never vanishes. This is still unproved.
Number of different primes occurring when 2n is expressed as p1+q1 = ... = pk+qk where pk,qk are odd primes with pk <= qk. For example when n=5: 10 = 3+7 = 5+5, we can see 3 different primes so a(5) = 3. - Naohiro Nomoto, Feb 24 2002
Comments from Tomás Oliveira e Silva to Number Theory List, Feb 05 2005: With the help of Siegfied "Zig" Herzog of PSU, I was able to verify the Goldbach conjecture up to 2e17. Let 2n=p+q, with p and q prime be a Goldbach partition of 2n. In a minimal Goldbach partition p is as small as possible. The largest p of a minimal Goldbach partition found was 8443 and is needed for 2n=121005022304007026. Furthermore, the largest prime gap found was 1220-1; it occurs after the prime 80873624627234849.
Comments from Tomás Oliveira e Silva to Number Theory List, Apr 26 2007: With the help of Siegfried "Zig" Herzog, the NCSA and others, I have just finished the verification of the Goldbach conjecture up to 1e18. This took about 320 years of CPU time, including a double-check of the results up to 1e17. As expected, no counterexample to the conjecture was found. As side results, the number of twin primes up to 1e18 was also computed, as was the number of primes in each of the residue classes modulo 120. Also, the number of occurrences of each (observed) prime gap was also recorded.
For n > 2 we have a(n) = 2*A002375(n)-1 if n is prime and a(n) = 2*A002375(n) if n is composite. - Emeric Deutsch, Jul 14 2004
For n > 2, a(n) = 2*A002375(n) - A010051(n). - Jason Kimberley, Aug 31 2011
a(n) = Sum_{p odd prime < 2*n} A010051(2*n - p). - Reinhard Zumkeller, Oct 19 2011
There is an interesting similarity with square numbers: The number of divisors of n is odd iff n is square (A000290). The number of decompositions of 2n into ordered sums of two primes (equaling the number of the unique primes in all such decompositions) is odd iff n is prime. - Ivan N. Ianakiev, Feb 28 2015

Examples

			2 has no such decompositions, so a(1) = 0.
Idem for 4, whence a(2) = 0.
6 = 3+3, so a(3) = 1.
8 = 3+5 = 5+3, so a(4) = 2.
10 = 5+5 = 3+7 = 7+3, so a(5) = 3.
12 = 5+7 = 7+5; so a(6) = 2, etc.
		

References

  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 9.
  • R. K. Guy, Unsolved problems in number theory, second edition, Springer-Verlag, 1994.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, Section 2.8 (for Goldbach conjecture).
  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, pp. 79, 80.
  • N. Pipping, Neue Tafeln für das Goldbachsche Gesetz nebst Berichtigungen zu den Haussnerschen Tafeln, Finska Vetenskaps-Societeten, Comment. Physico Math. 4 (No. 4, 1927), pp. 1-27.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. L. Stein and P. R. Stein, Tables of the Number of Binary Decompositions of All Even Numbers Less Than 200,000 into Prime Numbers and Lucky Numbers. Report LA-3106, Los Alamos Scientific Laboratory of the University of California, Los Alamos, NM, Sep 1964.

Crossrefs

Essentially identical to A035026.

Programs

  • Haskell
    a002372 n = sum $ map (a010051 . (2*n -)) $ takeWhile (< 2*n) a065091_list
    -- Reinhard Zumkeller, Oct 19 2011
    
  • Magma
    A002372 := func; [A002372(n):n in[1..82]]; // Jason Kimberley, Sep 01 2011
    
  • Maple
    a:=proc(n) local c,k; c:=0: for k from 1 to n do if isprime(2*k+1)=true and isprime(2*n-2*k-1)=true then c:=c+1 else c:=c fi od end: seq(a(n),n=1..82); # Emeric Deutsch, Jul 14 2004
  • Mathematica
    For[lst={}; n=1, n<=100, n++, For[cnt=0; i=1, i<=2n-1, i++ If[OddQ[i]&&PrimeQ[i]&&PrimeQ[2n-i], cnt++ ]]; AppendTo[lst, cnt]]; lst
    (* second program: *)
    A002372[n_] := Module[{i = 0}, Do[If[PrimeQ[2 n - Prime@p], i++], {p, 2, PrimePi[2 n - 3]}]; i]; Array[A002372, 82] (* JungHwan Min, Aug 24 2016 *)
    i[n_] := If[PrimeQ[2 n - 1], 2 n - 1, 0]; A085090 = Array[i, 82];
    r[n_] := Table[A085090[[k]] + A085090[[n - k + 1]], {k, 1, n}];
    countzeros[l_List] := Sum[KroneckerDelta[0, k], {k, l}];
    Table[n - 2 countzeros[A085090[[1 ;; n]]] + countzeros[r[n]],
    {n, 1, 82}] (* Fred Daniel Kline, Aug 13 2018 *)
    countPrimes[n_] := Sum[KroneckerDelta[True, PrimeQ[2 m - 1],
    PrimeQ[2 (n - m + 1) - 1]], {m, 1, n}]; Array[countPrimes, 82] (* Fred Daniel Kline, Oct 07 2018 *)
  • PARI
    isop(n) = (n % 2) && isprime(n);
    a(n) = n*=2; sum(i=1, n-1, isop(i)*isop(n-i)); \\ Michel Marcus, Aug 22 2014 and May 28 2020
    
  • Python
    from sympy import isprime, primerange
    def a(n): return sum([1 for p in primerange(3, 2*n-2) if isprime(2*n-p)])
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Apr 23 2017

Formula

a(n) = A010051(n) + 2*A061357(n), n > 2. - R. J. Mathar, Aug 19 2013

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jun 13 2002
Edited by M. F. Hasler, May 03 2019

A047160 For n >= 2, a(n) = smallest number m >= 0 such that n-m and n+m are both primes, or -1 if no such m exists.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

I have confirmed there are no -1 entries through integers to 4.29*10^9 using PARI. - Bill McEachen, Jul 07 2008
From Daniel Forgues, Jul 02 2009: (Start)
Goldbach's Conjecture: for all n >= 2, there are primes (distinct or not) p and q s.t. p+q = 2n. The primes p and q must be equidistant (distance m >= 0) from n: p = n-m and q = n+m, hence p+q = (n-m)+(n+m) = 2n.
Equivalent to Goldbach's Conjecture: for all n >= 2, there are primes p and q equidistant (distance >= 0) from n, where p and q are n when n is prime.
If this conjecture is true, then a(n) will never be set to -1.
Twin Primes Conjecture: there is an infinity of twin primes.
If this conjecture is true, then a(n) will be 1 infinitely often (for which each twin primes pair is (n-1, n+1)).
Since there is an infinity of primes, a(n) = 0 infinitely often (for which n is prime).
(End)
If n is composite, then n and a(n) are coprime, because otherwise n + a(n) would be composite. - Jason Kimberley, Sep 03 2011
From Jianglin Luo, Sep 22 2023: (Start)
a(n) < primepi(n)+sigma(n,0);
a(n) < primepi(primepi(n)+n);
a(n) < primepi(n), for n>344;
a(n) = o(primepi(n)), as n->+oo. (End)
If -1 < a(n) < n-3, then a(n) is divisible by 3 if and only if n is not divisible by 3, and odd if and only if n is even. - Robert Israel, Oct 05 2023

Examples

			16-3=13 and 16+3=19 are primes, so a(16)=3.
		

Crossrefs

Programs

  • Haskell
    a047160 n = if null ms then -1 else head ms
                where ms = [m | m <- [0 .. n - 1],
                                a010051' (n - m) == 1, a010051' (n + m) == 1]
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Magma
    A047160:=func;[A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011
    
  • Mathematica
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]
    smm[n_]:=Module[{m=0},While[AnyTrue[n+{m,-m},CompositeQ],m++];m]; Array[smm,100,2] (* Harvey P. Dale, Nov 16 2024 *)
  • PARI
    a(n)=forprime(p=n,2*n, if(isprime(2*n-p), return(p-n))); -1 \\ Charles R Greathouse IV, Jun 23 2017
  • UBASIC
    10 N=2// 20 M=0// 30 if and{prmdiv(N-M)=N-M,prmdiv(N+M)=N+M} then print M;:goto 50// 40 inc M:goto 30// 50 inc N: if N>130 then stop// 60 goto 20
    

Formula

a(n) = n - A112823(n).
a(n) = A082467(n) * A005171(n), for n > 3. - Jason Kimberley, Jun 25 2012

Extensions

More terms from Patrick De Geest, May 15 1999
Deleted a comment. - T. D. Noe, Jan 22 2009
Comment corrected and definition edited by Daniel Forgues, Jul 08 2009

A025583 Composite numbers that are not the sum of 2 primes.

Original entry on oeis.org

27, 35, 51, 57, 65, 77, 87, 93, 95, 117, 119, 121, 123, 125, 135, 143, 145, 147, 155, 161, 171, 177, 185, 187, 189, 203, 205, 207, 209, 215, 217, 219, 221, 237, 245, 247, 249, 255, 261, 267, 275, 287, 289, 291, 297, 299, 301, 303, 305, 321, 323, 325, 327, 329, 335, 341
Offset: 1

Views

Author

Keywords

Comments

Goldbach conjectured that every integer > 5 is the sum of three primes.
Conjecture: This is the sequence of odd numbers k such that (k mod x) mod 2 != 1, where x is the greatest m <= k such that m, m-1 and m-2 are all composite. Verified for first 10000 terms. - Benedict W. J. Irwin, May 06 2016
Numbers k, such that however many of k coins are placed with heads rather than tails showing, either those showing heads or those showing tails can be arranged in a rectangular pattern with multiple rows and columns. (If the Goldbach conjecture for even numbers is false this comment should be restricted to the odd terms of this sequence, as it might otherwise define a variant sequence). - Peter Munn, May 15 2017

Crossrefs

Programs

  • Haskell
    a025583 n = a025583_list !! (n-1)
    a025583_list = filter f a002808_list where
       f x = all (== 0) $ map (a010051 . (x -)) $ takeWhile (< x) a000040_list
    -- Reinhard Zumkeller, Oct 15 2014
  • Mathematica
    f[n_] := (p = 0; pn = PrimePi[n]; Do[ If[n == Prime[i] + Prime[k], p = p + 1; If[p > 2, Break[]]], {i, 1, pn}, {k, i, pn}]; p ); Select[Range[2, 400], ! PrimeQ[#] && f[#] == 0 & ] (* Jean-François Alcover, Mar 07 2011 *)
    upto=350;With[{c=PrimePi[upto]},Complement[Range[4,upto], Prime[Range[ c]], Union[Total/@Tuples[Prime[Range[c]],{2}]]]] (* Harvey P. Dale, Jul 14 2011 *)
    Select[Range[400],CompositeQ[#]&&Count[IntegerPartitions[#,{2}],?(AllTrue[ #,PrimeQ]&)]==0&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Feb 21 2021 *)

A103151 Number of decompositions of 2n+1 into 2p+q, where p and q are both odd primes (A065091).

Original entry on oeis.org

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

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Comments

Conjecture: all items for n>=4 are greater than or equal to 1. This is a stronger conjecture than the Goldbach conjecture.

Examples

			For 2*4+1 = 9 we have just one such composition: 9 = 2*3+3, so a(4)=1;
For 2*14+1 = 29 we have four such compositions: 29 = 2*3+23 = 2*5+19 = 2*11+7 = 2*13+3, so a(14)=4.
		

Crossrefs

Programs

  • Maple
    A103151 := proc(n)
        local s,a,q;
        a := 0 ;
        s := 2*n+1 ;
        for pi from 2 do
            q := s-2*ithprime(pi) ;
            if q <=2 then
                return a ;
            else
                if isprime(q) then
                    a := a+1 ;
                end if;
            end if;
        end do:
    end proc: # R. J. Mathar, Feb 22 2014
  • Mathematica
    Do[m = 3; ct = 0; While[(m*2) < n, If[PrimeQ[m], cp = n - (2*m); If[ PrimeQ[cp], ct = ct + 1]]; m = m + 2]; Print[ct], {n, 9, 299, 2}]

Extensions

Edited and Scheme-code added by Antti Karttunen, Jun 19 2007

A341945 Number of partitions of n into 2 primes (counting 1 as a prime).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Feb 24 2021

Keywords

Comments

Number of partitions of n into 2 noncomposite numbers, A008578. - Antti Karttunen, Dec 13 2021

Crossrefs

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, 3)
        end:
    a:= n-> coeff(b(n, numtheory[pi](n)), x, 2):
    seq(a(n), n=2..90);  # Alois P. Heinz, Feb 24 2021
  • Mathematica
    a[n_] := If[2 == n, 1, Module[{s = 0}, For[p = 2, True, p = NextPrime[p], If[p > n-p, Return[s + Boole[PrimeQ[n-1]]], s += Boole[PrimeQ[n-p]]]]]];
    Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Jan 03 2022, after Antti Karttunen *)
  • PARI
    A341945(n) = if(2==n,1,my(s=0); forprime(p=2,,if(p>(n-p), return(s+isprime(n-1)), s += isprime(n-p)))); \\ Antti Karttunen, Dec 13 2021

A065577 Number of Goldbach partitions of 10^n.

Original entry on oeis.org

2, 6, 28, 127, 810, 5402, 38807, 291400, 2274205, 18200488, 149091160, 1243722370, 10533150855, 90350630388
Offset: 1

Views

Author

Robert G. Wilson v, Dec 01 2001

Keywords

Comments

Number of ways of writing 10^n as the sum of two odd primes, when the order does not matter.

Examples

			a(1)=2 because 10 = 3+7 = 5+5;
a(2)=6 because 100 = 3+97 = 11+89 = 17+83 = 29+71 = 41+59 = 47+53; ...
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{c = 0, lmt = n/2, p = 3}, While[p <= lmt, If[ PrimeQ[n - p], c++ ]; p = NextPrim@p]; c]; Array[f, 10] (* Robert G. Wilson v, Nov 01 2006 *)
    a[n]:=Length[Select[n - Prime[Range[PrimePi[n/2]]], PrimeQ]]; Table[a[n],{n, 10^3, 10^3}] (* Luciano Ancora, Mar 16 2015 *)

Formula

a(n) = A061358(10^n).

Extensions

a(9) from Zak Seidov Nov 01 2006
a(10) from R. J. Mathar and David W. Wilson, Nov 02 2006
a(11) from David W. Wilson and Russ Cox, Nov 03 2006
a(12) from Russ Cox, Nov 04 2006
a(13) from Donovan Johnson, Nov 16 2009
a(14) from Huang Yuanbing (bailuzhou(AT)163.com), Dec 24 2009

A103152 Smallest odd number which can be written as a sum 2p+q (where p and q are both odd primes, A065091) in exactly n ways, zero if there are no such odd number.

Original entry on oeis.org

9, 13, 17, 29, 45, 51, 69, 81, 99, 93, 105, 135, 153, 201, 195, 165, 231, 237, 321, 297, 225, 363, 725, 393, 285, 315, 471, 483, 435, 405, 465, 561, 555, 495, 609, 783, 675, 867, 849, 963, 645, 525, 693, 897, 795, 915, 987, 735, 855, 825, 765, 1095, 975, 1467
Offset: 1

Views

Author

Lei Zhou, Feb 09 2005

Keywords

Comments

Conjecture: except for the 2nd, 3rd and 4th terms, all other terms are divisible by 3; See also comments in A103151.
a(23)=725 is also not divisible by 3. [D. S. McNeil, Sep 06 2010]
The only terms a(n) not divisible by 3 for n <= 1450 are a(2),a(3),a(4) and a(23). - Robert Israel, Mar 17 2020

Examples

			9 is the smallest odd number with just one such composition: 9 = 3+2*3, thus a(1)=9.
Similarly, 13 is smallest with exactly 2 compositions: 13 = 3+2*5 = 7+2*3, thus a(2)=13.
		

Crossrefs

Programs

  • Maple
    N:= 2000: # for terms before the first term > N
    P:= select(isprime, [seq(i,i=3..N,2)]):
    nP:= nops(P):
    V:= Vector(N):
    for i from 1 while 2*P[i] N then break fi;
        V[k]:= V[k]+1;
    od od:
    A:= Vector(N):
    for i from 1 to N by 2 do if V[i] <> 0 and A[V[i]] = 0 then A[V[i]]:= i fi od:
    for i from 1 to N do if A[i] = 0 then break fi od:
    seq(A[j],j=1..i-1); # Robert Israel, Mar 17 2020
  • Mathematica
    Array[a, 300]; Do[a[n] = 0, {n, 1, 300}]; n = 9; ct = 0; While[ct < 200, m = 3; ct = 0; While[(m*2) < n, If[PrimeQ[m], cp = n - (2* m); If[PrimeQ[cp], ct = ct + 1]]; m = m + 2]; If[a[ct] == 0, a[ct] = n]; n = n + 2]; Print[a]
  • Scheme
    (define (A103152 n) (+ 1 (* 2 (first-n-where-fun_n-is-i1 A103151 n))))
    (define (first-n-where-fun_n-is-i1 fun i) (let loop ((n 1)) (cond ((= i (fun n)) n) (else (loop (+ n 1)))))) ;; Antti Karttunen, Jun 19 2007

Extensions

Starting offset changed from 0 to 1 by Antti Karttunen, Jun 19 2007

A347744 Number of compositions (ordered partitions) of n into at most 2 prime parts (counting 1 as a prime).

Original entry on oeis.org

1, 1, 2, 3, 3, 3, 3, 3, 4, 2, 3, 1, 4, 3, 5, 2, 4, 1, 6, 3, 6, 2, 5, 1, 8, 2, 5, 0, 4, 1, 8, 3, 6, 2, 7, 0, 8, 1, 5, 2, 6, 1, 10, 3, 8, 2, 7, 1, 12, 2, 8, 0, 6, 1, 12, 2, 6, 0, 7, 1, 14, 3, 7, 2, 10, 0, 12, 1, 6, 2, 10, 1, 14, 3, 11, 2, 10, 0, 14, 1, 10
Offset: 0

Views

Author

Ilya Gutkovskiy, Sep 11 2021

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length@Flatten[Permutations/@IntegerPartitions[n,2,Join[{1},Prime@Range@PrimePi@n]],1],{n,0,80}] (* Giorgos Kalogeropoulos, Sep 12 2021 *)
  • PARI
    { a(n) = local(s(n) = if(n<2,1,isprime(n))); if(n==0,1,sum(i=1,n,s(i)*s(n-i))); } \\ Christian Krause, Dec 06 2022

A096139 Number of ways to write 2*n as an ordered sum of two numbers which are prime or 1.

Original entry on oeis.org

1, 3, 3, 4, 3, 4, 5, 4, 6, 6, 5, 8, 5, 4, 8, 6, 7, 8, 5, 6, 10, 8, 7, 12, 8, 6, 12, 6, 7, 14, 7, 10, 12, 6, 10, 14, 11, 10, 14, 10, 9, 18, 9, 8, 20, 8, 9, 14, 8, 12, 18, 12, 11, 18, 14, 14, 22, 12, 11, 24, 7, 10, 20, 8, 14, 20, 11, 10, 18, 16, 15, 22, 11, 10, 26, 10, 16, 22, 11, 16, 20, 12
Offset: 1

Views

Author

David Stroup, Jul 23 2004

Keywords

Comments

A001031(n) = floor((a(n)+1)/2); a(n) mod 2 = A010051(n). - Reinhard Zumkeller, Aug 28 2013

Examples

			a(2)=3 because 4=1+3 or 4=2+2 or 4=3+1;
a(3)=3 because 6=1+5 or 6=3+3 or 6=5+1;
a(4)=4 because 8=1+7 or 8=3+5 or 8=5+3 or 8=7+1;
a(5)=3 because 10=3+7 or 10=5+5 or 10=7+3.
		

Crossrefs

Programs

  • Haskell
    a096139 n = sum (map a010051 gs') + fromEnum (1 `elem` gs')
       where gs' = map (2 * n -) $ takeWhile (< 2 * n) a008578_list
    -- Reinhard Zumkeller, Aug 28 2013
    
  • PARI
    { a(n) = local(s(n) = if(n==1,1,isprime(n))); sum(i=1,2*n,s(i)*s(2*n-i)); } \\ Christian Krause, Dec 06 2022

Extensions

Example extended and typo fixed by Reinhard Zumkeller, Aug 28 2013
Showing 1-10 of 22 results. Next