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

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

A107926 The least number k such that there are primes p and q with p - q = 2*n, p + q = k, and p the least such prime >= k/2.

Original entry on oeis.org

4, 8, 18, 16, 54, 48, 50, 108, 102, 44, 234, 444, 98, 228, 174, 92, 414, 432, 242, 516, 582, 256, 1182, 672, 406, 612, 846, 272, 1038, 984, 442, 1776, 1902, 292, 1074, 636, 1054, 3312, 1122, 476, 1398, 1464, 530, 1728, 2730, 572, 2706, 3348, 682, 2844, 3342
Offset: 0

Views

Author

Gilmar J. Rodriguez (Gilmar.Rodriguez(AT)nwfwmd.state.fl.us) and Robert G. Wilson v, Jun 16 2005

Keywords

Comments

From the Goldbach conjecture.
A107926 = 2*A103147 by definition.
a(3n)> a(3n-2), a(3n-1), a(3n+1) & a(3n+2) for all n > 0 except for n = 1, 2, 12, 19, 20 or 41.
Of those values found so far a(3n+2) > a(3n+1) by ~8%. - Robert G. Wilson v, Nov 03 2013
Except for 1, all indices, i, not congruent to 0 (mod 3), a(i) is congruent to 0 (mod 6) and for all indices, i, congruent to 0 (mod 3), a(i) is not congruent to 0 (mod 6). Of those not congruent to 0 (mod 6), those congruent to 2 outnumber those congruent to 4, about 8 to 7. Robert G. Wilson v, Nov 03 2013

Examples

			a(0) = 4 because 4=2+2 and 2-2=0.
a(1) = 8 because 8 is the least number with 8=p+q and p-q=2 for primes p and q.
a(2) = 18 because 18=7+11 and the primes 7 and 11 have difference 4.
		

Crossrefs

Cf. A066285, A103147, records in A065978 and A066286.

Programs

  • Mathematica
    f[n_] := For[p = n/2, True, p--, If[PrimeQ[p] && PrimeQ[n - p], Return[n/2 - p]]]; nn=101; t=Table[0,{nn}]; cnt=0; n=1; While[cnt
    				

A155766 Least prime p such that p + 2n is prime, but not both p+2k and p+2(n-k) are prime for 0 < k < n.

Original entry on oeis.org

2, 3, 7, 5, 23, 19, 19, 47, 43, 13, 107, 211, 37, 101, 73, 31, 191, 199, 103, 239, 271, 107, 569, 313, 179, 281, 397, 109, 491, 463, 191, 857, 919, 113, 503, 283, 491, 1619, 523, 199, 659, 691, 223, 821, 1321, 241, 1307, 1627, 293, 1373, 1621, 751, 2399, 823, 499
Offset: 0

Views

Author

T. D. Noe, Jan 27 2009

Keywords

Comments

Does a(n) exist for all n? It appears that a(3n) is less than a(3n-1) and a(3n+1) for all n except 2 and 12.

Formula

a(n) = A103147(n) - n = A155767(n) - 2n.

A155767 Least prime p such that p - 2n is prime, but not both p-2k and p-2(n-k) are prime for 0 < k < n.

Original entry on oeis.org

2, 5, 11, 11, 31, 29, 31, 61, 59, 31, 127, 233, 61, 127, 101, 61, 223, 233, 139, 277, 311, 149, 613, 359, 227, 331, 449, 163, 547, 521, 251, 919, 983, 179, 571, 353, 563, 1693, 599, 277, 739, 773, 307, 907, 1409, 331, 1399, 1721, 389, 1471, 1721, 853, 2503, 929
Offset: 0

Views

Author

T. D. Noe, Jan 27 2009

Keywords

Comments

Does a(n) exist for all n? It appears that a(3n) is less than a(3n-1) and a(3n+1) for all n except 1, 2 and 12.

Formula

a(n) = A103147(n) + n = A155766(n) + 2n.
Showing 1-4 of 4 results.