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-6 of 6 results.

A067076 Numbers k such that 2*k + 3 is a prime.

Original entry on oeis.org

0, 1, 2, 4, 5, 7, 8, 10, 13, 14, 17, 19, 20, 22, 25, 28, 29, 32, 34, 35, 38, 40, 43, 47, 49, 50, 52, 53, 55, 62, 64, 67, 68, 73, 74, 77, 80, 82, 85, 88, 89, 94, 95, 97, 98, 104, 110, 112, 113, 115, 118, 119, 124, 127, 130, 133, 134, 137, 139, 140, 145, 152, 154, 155
Offset: 1

Views

Author

David Williams, Aug 17 2002

Keywords

Comments

The following sequences (allowing offset of first term) all appear to have the same parity: A034953, triangular numbers with prime indices; A054269, length of period of continued fraction for sqrt(p), p prime; A082749, difference between the sum of next prime(n) natural numbers and the sum of next n primes; A006254, numbers n such that 2n-1 is prime; A067076, 2n+3 is a prime. - Jeremy Gardiner, Sep 10 2004
n is in the sequence iff none of the numbers (n-3k)/(2k+1), 1 <= k <= (n-1)/5, is positive integer. - Vladimir Shevelev, May 31 2009
Zeta(s) = Sum_{n>=1} 1/n^s = 1/1 - 2^(-s) * Product_{p=prime=(2*A067076)+3} 1/(1 - (2*A067076+3)^(-s)). - Eric Desbiaux, Dec 15 2009
This sequence is a subsequence of A047949. - Jason Kimberley, Aug 30 2012

Crossrefs

Numbers n such that 2n+k is prime: A005097 (k=1), this seq(k=3), A089038 (k=5), A105760 (k=7), A155722 (k=9), A101448 (k=11), A153081 (k=13), A089559 (k=15), A173059 (k=17), A153143 (k=19). - Jason Kimberley, Sep 07 2012
Numbers n such that 2n-k is prime: A006254 (k=1), A098090 (k=3), A089253 (k=5), A089192 (k=7), A097069 (k=9), A097338 (k=11), A097363 (k=13), A097480 (k=15), A098605 (k=17), A097932 (k=19).

Programs

Formula

a(n) = A006254(n) - 2 = A086801(n+1)/2. [Corrected by M. F. Hasler, Feb 14 2024]
a(n) = A089253(n) - 4. - Giovanni Teofilatto, Dec 14 2003
Conjecture: a(n) = A008507(n) + n - 1 = A005097(n) - 1 = A102781(n+1) - 1. - R. J. Mathar, Jul 07 2009
a(n) = A179893(n) - A000040(n). - Odimar Fabeny, Aug 24 2010

Extensions

Offset changed from 0 to 1 in 2008: some formulas here and elsewhere may need to be corrected.

A020481 Least p with p, q both prime, p+q = 2n.

Original entry on oeis.org

2, 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, 3, 5, 7
Offset: 2

Views

Author

Keywords

Comments

Essentially the same as A002373, which does not have the a(2) term. - T. D. Noe, Sep 24 2007
a(n) = A171637(n,1). - Reinhard Zumkeller, Mar 03 2014
Conjecture: a(n) ~ O(n^1/2). - Jon Perry, Apr 29 2014

Crossrefs

Cf. A020482.

Programs

  • Haskell
    a020481 n = head [p | p <- a000040_list, a010051' (2 * n - p) == 1]
    -- Reinhard Zumkeller, Jul 07 2014, Mar 03 2014
    
  • Mathematica
    a[n_] := For[p = 2, True, p = NextPrime[p], If[PrimeQ[2n-p], Return[p]]];
    Table[a[n], {n, 2, 103}] (* Jean-François Alcover, Jul 31 2018  *)
  • PARI
    A020481(n) = {local(np);np=1;while(!isprime(2*n-prime(np)),np++);prime(np)} \\ Michael B. Porter, Dec 11 2009
    
  • PARI
    A020481(n)=forprime(p=1,n,isprime(2*n-p)&return(p)) \\ M. F. Hasler, Sep 18 2012
    
  • Python
    from sympy import isprime, primerange
    def A020481(n): return next(filter(lambda p:isprime((n<<1)-p),primerange(2*n))) # Chai Wah Wu, Nov 19 2024

Formula

a(n) = n - A047949(n). - Jason Kimberley, Oct 09 2012

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

A182138 Irregular triangle T, read by rows, in which row n lists the distances between n and the two primes whose sum makes 2n in decreasing order (Goldbach conjecture).

Original entry on oeis.org

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

Views

Author

Jean COHEN, Apr 16 2012

Keywords

Comments

The Goldbach conjecture is that for any even integer 2n>=4, at least one pair of primes p and q exist such that p+q=2n. The present numbers listed here are the distances d between each prime and n, the half of the even integer 2n: d=n-p=q-n with p <= q.
See the link section for plots I added. - Jason Kimberley, Oct 04 2012
Each nonzero entry d of row n is coprime to n. For otherwise n+d would be composite. - Jason Kimberley, Oct 10 2012

Examples

			n=2, 2n=4, 4=2+2, p=q=2 -> d=0.
n=18, 2n=36, four prime pairs have a sum of 36: 5+31, 7+29, 13+23, 17+19, with the four distances d being 13=18-5=31-18, 11=18-7=29-18, 5=18-13=23-18, 1=18-17=19-18.
Triangle begins:
  0;
  0;
  1;
  2, 0;
  1;
  4, 0;
  5, 3;
  4, 2;
  7, 3;
  8, 6, 0;
		

Crossrefs

Cf. A045917 (row lengths), A047949 (first column), A047160 (last elements of rows).
Cf. A184995.

Programs

Formula

T(n,i) = n - A184995(n,i). - Jason Kimberley, Sep 25 2012

A303603 a(n) is the maximum distance between primes in Goldbach partitions of 2n, or 2n if there are no Goldbach partitions of 2n.

Original entry on oeis.org

0, 0, 0, 2, 4, 2, 8, 10, 8, 14, 16, 14, 20, 18, 16, 26, 28, 26, 24, 34, 32, 38, 40, 38, 44, 42, 40, 50, 48, 46, 56, 58, 56, 54, 64, 62, 68, 70, 68, 66, 76, 74, 80, 78, 76, 86, 84, 82, 60, 94, 92, 98, 100, 98, 104, 106, 104, 110, 108, 106, 96, 102, 100, 90, 124, 122, 128, 126, 124, 134, 136, 134, 132
Offset: 1

Views

Author

Marcin Barylski, Apr 26 2018

Keywords

Comments

The Goldbach Strong Conjecture is true if and only if a(n) = 2n for some n.
Terms are always even numbers because primes present in Goldbach partitions of n > 4 are odd and n = 4 has just one partition (2+2) where difference is 0.
Conjecture: Only first terms are 0 and all further terms are bigger than 0. Excluding a(1), a(n) = 0 iff the only Goldbach partition of 2n is n+n.

Examples

			a(1) = 0 for coherence with other related sequences.
a(2) = 0 because 2 * 2 = 4 = 2 + 2 and max_diff = 2 - 2 = 0.
a(8) = 10 because 2 * 8 = 16 = 5 + 11 = 3 + 13 and max_diff = 13 - 3 = 10.
		

Crossrefs

Cf. A002372, A002375, A047949, A066285 (minimum distance), A305883.

Programs

  • Mathematica
    a[1]=a[2]=0;
    a[n_]:=Module[{p=3},While[PrimeQ[2*n-p]!=True,p=NextPrime[p]];2*(n-p)];
    a/@Range[73] (* Ivan N. Ianakiev, Jun 27 2018 *)
  • PARI
    a(n) = if (n==1, 0, forprime(p=2, , if (isprime(2*n-p), return (2*n-2*p)))); \\ Michel Marcus, Jul 02 2018

Formula

a(n) = 2 * A047949(n) if A047949(n) > 0 for n >= 2; a(n) = 2n if A047949(n) = -1. - Alois P. Heinz, Jun 01 2020

A075469 Maximal m such that n^n-m and n^n+m are both primes, or -1 if there is no such m.

Original entry on oeis.org

1, 20, 253, 3122, 46651, 823540, 16777155, 387420478, 9999999939, 285311670528, 8916100448227, 302875106592216, 11112006825558003, 437893890380859368, 18446744073709551537, 827240261886336764070, 39346408075296537575383
Offset: 2

Views

Author

Lior Manor, Sep 18 2002

Keywords

Comments

Are there any negative terms?
Of course the Goldbach conjecture implies that the answer is "no"; further, the first thousand terms are positive. - Charles R Greathouse IV, Mar 16 2016

Examples

			a(4) = 253 since 4^4-253 = 3 and 4^4+253 = 509 are both prime.
		

Crossrefs

Programs

  • PARI
    a(n)=my(N=n^n); forprime(p=2,N, if(isprime(2*N-p), return(N-p))); -1 \\ Charles R Greathouse IV, Mar 16 2016

Formula

a(n) = A047949(n^n). - Michel Marcus, Jun 09 2013
Showing 1-6 of 6 results.