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 57 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

A014092 Numbers that are not the sum of 2 primes.

Original entry on oeis.org

1, 2, 3, 11, 17, 23, 27, 29, 35, 37, 41, 47, 51, 53, 57, 59, 65, 67, 71, 77, 79, 83, 87, 89, 93, 95, 97, 101, 107, 113, 117, 119, 121, 123, 125, 127, 131, 135, 137, 143, 145, 147, 149, 155, 157, 161, 163, 167, 171, 173, 177, 179, 185, 187, 189, 191, 197, 203, 205, 207, 209
Offset: 1

Views

Author

Keywords

Comments

Suggested by the Goldbach conjecture that every even number larger than 2 is the sum of 2 primes.
Since (if we believe the Goldbach conjecture) all the entries > 2 in this sequence are odd, they are equal to 2 + an odd composite number (or 1).
Otherwise said, the sequence consists of 2 and odd numbers k such that k-2 is not prime. In particular there is no element from A006512, greater of a twin prime pair. - M. F. Hasler, Sep 18 2012
Values of k such that A061358(k) = 0. - Emeric Deutsch, Apr 03 2006
Values of k such that A073610(k) = 0. - Graeme McRae, Jul 18 2006

References

  • 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).

Crossrefs

Cf. A010051, A000040, A051035 (composites).
Equivalent sequence for prime powers: A071331.
Numbers that can be expressed as the sum of two primes in k ways for k=0..10: this sequence (k=0), A067187 (k=1), A067188 (k=2), A067189 (k=3), A067190 (k=4), A067191 (k=5), A066722 (k=6), A352229 (k=7), A352230 (k=8), A352231 (k=9), A352233 (k=10).

Programs

  • Haskell
    a014092 n = a014092_list !! (n-1)
    a014092_list = filter (\x ->
       all ((== 0) . a010051) $ map (x -) $ takeWhile (< x) a000040_list) [1..]
    -- Reinhard Zumkeller, Sep 28 2011
    
  • Maple
    g:=sum(sum(x^(ithprime(i)+ithprime(j)),i=1..j),j=1..50): gser:=series(g,x=0,230): a:=proc(n) if coeff(gser,x^n)=0 then n else fi end: seq(a(n),n=1..225); # Emeric Deutsch, Apr 03 2006
  • Mathematica
    s1falsifiziertQ[s_]:= Module[{ip=IntegerPartitions[s, {2}], widerlegt=False},Do[If[PrimeQ[ip[[i,1]] ] ~And~ PrimeQ[ip[[i,2]] ], widerlegt = True; Break[]],{i,1,Length[ip]}];widerlegt]; Select[Range[250],s1falsifiziertQ[ # ]==False&] (* Michael Taktikos, Dec 30 2007 *)
    Join[{1,2},Select[Range[3,300,2],!PrimeQ[#-2]&]] (* Zak Seidov, Nov 27 2010 *)
    Select[Range[250],Count[IntegerPartitions[#,{2}],?(AllTrue[#,PrimeQ]&)]==0&] (* _Harvey P. Dale, Jun 08 2022 *)
  • PARI
    isA014092(n)=local(p,i) ; i=1 ; p=prime(i); while(pA014092(a), print(n," ",a); n++)) \\ R. J. Mathar, Aug 20 2006
    
  • Python
    from sympy import prime, isprime
    def ok(n):
        i=1
        x=prime(i)
        while xIndranil Ghosh, Apr 29 2017

Formula

Odd composite numbers + 2 (essentially A014076(n) + 2 ).
Equals {2} union A005408 \ A052147, i.e., essentially the complement of A052147 (or rather A048974) within the odd numbers A005408. - M. F. Hasler, Sep 18 2012

A002373 Smallest prime in decomposition of 2n into sum of two odd primes.

Original entry on oeis.org

3, 3, 3, 5, 3, 3, 5, 3, 3, 5, 3, 5, 7, 3, 3, 5, 7, 3, 5, 3, 3, 5, 3, 5, 7, 3, 5, 7, 3, 3, 5, 7, 3, 5, 3, 3, 5, 7, 3, 5, 3, 5, 7, 3, 5, 7, 19, 3, 5, 3, 3, 5, 3, 3, 5, 3, 5, 7, 13, 11, 13, 19, 3, 5, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 7, 3, 5, 7, 3, 5, 3, 5, 7, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 3
Offset: 3

Views

Author

Keywords

Comments

See A020481 for another version.
a(A208662(n)) = A065091(n) and a(m) <> A065091(n) for m < A208662(n). - Reinhard Zumkeller, Feb 29 2012
Records are in A025019, their indices in A051610. - Ralf Stephan, Dec 29 2013
Note that these primes do not all belong to a twin prime pair. The first instance is a(110) = 23. - Michel Marcus, Aug 17 2020 from a suggestion by Pierre CAMI

References

  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 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).

Crossrefs

Programs

  • Haskell
    a002373 n = head $ dropWhile ((== 0) . a010051 . (2*n -)) a065091_list -- Reinhard Zumkeller, Feb 29 2012
    
  • Mathematica
    Table[k = 2; While[q = Prime[k]; ! PrimeQ[2*n - q], k++]; q, {n, 3, 100}] (* Jean-François Alcover, Apr 26 2011 *)
    Table[Min[Flatten[Select[IntegerPartitions[2*n,{2}],AllTrue[ #,OddQ] && AllTrue[#,PrimeQ]&]]],{n,3,100}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 31 2020 *)
  • PARI
    a(n)=forprime(p=3,n,if(isprime(2*n-p), return(p))) \\ Charles R Greathouse IV, May 18 2015

Extensions

More terms from Ray Chandler, Sep 19 2003

A219864 Number of ways to write n as p+q with p and 2pq+1 both prime.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Nov 30 2012

Keywords

Comments

Conjecture: a(n)>0 for all n>7.
This has been verified for n up to 3*10^8.
Zhi-Wei Sun also made the following general conjecture: For each odd integer m not congruent to 5 modulo 6, any sufficiently large integer n can be written as p+q with p and 2*p*q+m both prime.
For example, when m = 3, -3, 7, 9, -9, -11, 13, 15, it suffices to require that n is greater than 1, 29, 16, 224, 29, 5, 10, 52 respectively.
Sun also guessed that any integer n>4190 can be written as p+q with p, 2*p*q+1, 2*p*q+7 all prime, and any even number n>1558 can be written as p+q with p, q, 2*p*q+3 all prime. He has some other similar observations.

Examples

			a(10)=2 since 10=3+7=7+3 with 2*3*7+1=43 prime.
a(263)=1 since 83 is the only prime p with 2p(263-p)+1 prime.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=a[n]=Sum[If[PrimeQ[2Prime[k](n-Prime[k])+1]==True,1,0],{k,1,PrimePi[n]}]
    Do[Print[n," ",a[n]],{n,1,1000}]

A001031 Goldbach conjecture: a(n) = number of decompositions of 2n into sum of two primes (counting 1 as a prime).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Number of decompositions of 2*n into sum of two noncomposite numbers. - Omar E. Pol, Dec 12 2024

Examples

			1 is counted as a prime, so a(1)=1 since 2=1+1, a(2)=2 since 4=2+2=3+1, ..
		

References

  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 9.
  • Deshouillers, J.-M.; te Riele, H. J. J.; and Saouter, Y.; New experimental results concerning the Goldbach conjecture. Algorithmic number theory (Portland, OR, 1998), 204-215, Lecture Notes in Comput. Sci., 1423, Springer, Berlin, 1998.
  • Apostolos Doxiadis: Uncle Petros and Goldbach's Conjecture, Faber and Faber, 2001
  • R. K. Guy, Unsolved problems in number theory, second edition, Springer-Verlag, 1994.
  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 79.
  • 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

Programs

  • Haskell
    a001031 n = sum (map a010051 gs) + fromEnum (1 `elem` gs)
       where gs = map (2 * n -) $ takeWhile (<= n) a008578_list
    -- Reinhard Zumkeller, Aug 28 2013
    
  • Mathematica
    nn = 10^2; ps = Boole[PrimeQ[Range[2*nn]]]; ps[[1]] = 1; Table[Sum[ps[[i]] ps[[2*n - i]], {i, n}], {n, nn}] (* T. D. Noe, Apr 11 2011 *)
  • PARI
    a(n)=my(s); forprime(p=2,n, if(isprime(2*n-p), s++)); if(isprime(2*n-1), s+1, s) \\ Charles R Greathouse IV, Feb 06 2017

Formula

Not very efficient: a(n) = (Sum_{i=1..n} (pi(i) - pi(i-1))*(pi(2*n-i) - pi(2*n-i-1))) + (pi(2*n-1) - pi(2*n-2)) + floor(1/n). - Wesley Ivan Hurt, Jan 06 2013
a(n) = floor((A096139(n)+1)/2). - Reinhard Zumkeller, Aug 28 2013

Extensions

More terms from Ray Chandler, Sep 19 2003

A035026 Number of times that i and 2n-i are both prime, for i = 1, ..., 2n-1.

Original entry on oeis.org

0, 1, 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

Gordon R. Bower (siegmund(AT)mosquitonet.com)

Keywords

Comments

a(n) is the convolution of terms 1 to 2n of the characteristic function of the primes, A010051, with itself. Related to Goldbach's conjecture that every even number can be expressed as the sum of two primes. - T. D. Noe, Aug 01 2002
The following sequences all appear to have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
Total number of printer jobs in all possible schedules for n time slots in the first-come-first-served (FCFS) policy.
a(n) = Sum_{p prime < 2*n} A010051(2*n - p). - Reinhard Zumkeller, Oct 19 2011
For n > 1: length of n-th row of triangle A171637. - Reinhard Zumkeller, Mar 03 2014
a(n) = A001221(A238711(n)) = A238778(n) / n. - Reinhard Zumkeller, Mar 06 2014
From Robert G. Wilson v, Dec 15 2016: (Start)
First occurrence of k: 1, 2, 4, 5, 8, 11, 12, 17, 18, 37, 24, 53, 30, 89, 39, 71, 42, 101, 45, 179, 57, 137, 72, 193, 60, 233, ..., .
Conjectured last occurrence of k: 1, 3, 6, 19, 34, 31, 64, 61, 76, 79, 94, 83, 166, 199, 136, 181, 184, 229, 244, 271, 316, 277, 346, 313, 301, 293, ..., .
Conjectured number occurrences of k: 1, 2, 2, 3, 6, 3, 8, 4, 7, 5, 11, 5, 11, 8, 10, 3, 17, 7, 16, 3, 13, 8, 21, 4, 12, 3, 22, 7, 20, 8, 15, ..., .
Records: 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 24, 26, 28, 38, 42, 48, 54, 60, 64, 82, 88, 102, 104, 114, 116, 136, 146, 152, 166, 182, ..., .
(End)

Crossrefs

Cf. A010051. Essentially the same as A002372.
Cf. A073610.

Programs

  • Haskell
    a035026 n = sum $ map (a010051 . (2 * n -)) $
       takeWhile (< 2 * n) a000040_list
    -- Reinhard Zumkeller, Oct 19 2011
  • Maple
    A035026 := proc(n)
        local a,i ;
        a := 0 ;
        for i from 1 to 2*n-1 do
            if isprime(i) and isprime(2*n-i) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Jul 01 2013
  • Mathematica
    For[lst={}; n=1, n<=100, n++, For[cnt=0; i=1, i<=2n-1, i++ If[PrimeQ[i]&&PrimeQ[2n-i], cnt++ ]]; AppendTo[lst, cnt]]; lst
    f[n_] := Block[{c = Boole@ PrimeQ[ n/2], p = 2}, While[ 2p < n, If[ PrimeQ[n - p], c += 2]; p = NextPrime@ p]; c];; Array[ f[ 2#] &, 90] (* Robert G. Wilson v, Dec 15 2016 *)

Formula

For n > 1, a(n) = 2*A045917(n) - A010051(n).
a(n) = A010051(n) + 2*A061357(n). - Wesley Ivan Hurt, Aug 21 2013
a(n) = A073610(2*n). - Ridouane Oudra, Sep 06 2023

Extensions

Corrected by T. D. Noe, May 05 2002

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

A002374 Largest prime <= n in any decomposition of 2n into a sum of two odd primes.

Original entry on oeis.org

3, 3, 5, 5, 7, 5, 7, 7, 11, 11, 13, 11, 13, 13, 17, 17, 19, 17, 19, 13, 23, 19, 19, 23, 23, 19, 29, 29, 31, 23, 29, 31, 29, 31, 37, 29, 37, 37, 41, 41, 43, 41, 43, 31, 47, 43, 37, 47, 43, 43, 53, 47, 43, 53, 53, 43, 59, 59, 61, 53, 59, 61, 59, 61, 67, 53, 67, 67, 71, 71, 73, 59
Offset: 3

Views

Author

Keywords

Comments

Sequence A112823 is identical except that it is very naturally extended to a(2) = 2, i.e., the word "odd" is dropped from the definition. - M. F. Hasler, May 03 2019

References

  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 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).

Crossrefs

Essentially the same as A112823. - Franklin T. Adams-Watters, Jan 25 2010

Programs

  • Mathematica
    nmax = 74; a[n_] := (k = 0; While[k < n && (!PrimeQ[n-k] || !PrimeQ[n+k]), k++]; If[k == n, n+1, n-k]); Table[a[n], {n, 3, nmax}](* Jean-François Alcover, Nov 14 2011, after Jason Kimberley *)
    lp2n[n_]:=Max[Select[Flatten[Select[IntegerPartitions[2n,{2}],AllTrue[ #, PrimeQ]&]],#<=n&]]; Array[lp2n,80,2] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jun 08 2018 *)
  • PARI
    a(n)=forstep(k=n,1,-1, if(isprime(k) && isprime(2*n-k), return(k))) \\ Charles R Greathouse IV, Feb 07 2017
    
  • PARI
    A002374(n)=forprime(q=n, 2*n, isprime(2*n-q)&&return(2*n-q)) \\ M. F. Hasler, May 03 2019

Formula

a(n) = n - A047160(n) = A112823(n) (for n >= 3). - Jason Kimberley, Aug 31 2011

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 21 2000

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 *)

A218754 Number of ways to write n=p+q(3+(-1)^n)/2 with q<=n/2 and p, q, p^2+3pq+q^2 all prime.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Nov 04 2012

Keywords

Comments

Conjecture: a(n)>0 for all n>=1188.
Conjecture verified for n up to 10^9. - Mauro Fiorentini, Sep 23 2023
This conjecture is stronger than both Goldbach's conjecture and Lemoine's conjecture.
Zhi-Wei Sun also made the following conjecture: Given any positive odd integer d, there is a prime p(d) such that for any prime p>p(d) there is a prime q

Conjecture verified for d up to 100 and p up to 10^7. - Mauro Fiorentini, Sep 23 2023

Examples

			For n=72 we have a(72)=1 since the only primes p and q with p+q=72, q<=36 and p^2+3pq+q^2 prime are p=67 and q=5.
		

Crossrefs

Cf. A000034 = 1,2,1,2,... = (3-(-1)^n)/2. (Note: Offset shifted w.r.t. use in the definition of this sequence.) - M. F. Hasler, Nov 05 2012

Programs

  • Mathematica
    a[n_]:=a[n]=Sum[If[PrimeQ[q]==True&&PrimeQ[n-q(3-(-1)^n)/2]&&PrimeQ[q^2+3q(n-q(3-(-1)^n)/2)+(n-q(3-(-1)^n)/2)^2]==True,1,0],{q,1,n/2}]
    Do[Print[n," ",a[n]],{n,1,20000}]
Showing 1-10 of 57 results. Next