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

A066285 a(n) is the minimal difference between primes p and q whose sum is 2n.

Original entry on oeis.org

0, 0, 2, 0, 2, 0, 6, 4, 6, 0, 2, 0, 6, 4, 6, 0, 2, 0, 6, 4, 18, 0, 10, 12, 6, 8, 18, 0, 2, 0, 18, 8, 6, 12, 10, 0, 18, 4, 6, 0, 2, 0, 6, 4, 30, 0, 10, 24, 6, 16, 18, 0, 14, 24, 6, 8, 30, 0, 2, 0, 18, 8, 6, 12, 10, 0, 30, 4, 6, 0, 2, 0, 30, 8, 6, 12, 10, 0, 18, 4, 30, 0, 10, 24, 6, 28, 18, 0
Offset: 2

Views

Author

Dean Hickerson, Dec 12 2001

Keywords

Comments

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 the difference is 0. a(n) = 0 iff n is prime. - Marcin Barylski, Apr 28 2018

Crossrefs

Programs

  • Mathematica
    a[n_] := For[p=n, True, p--, If[PrimeQ[p]&&PrimeQ[2n-p], Return[2n-2p]]]
  • PARI
    a(n) = {forstep(k=n, 1, -1, if (isprime(k) && isprime(2*n-k), return(2*n-2*k)););} \\ Michel Marcus, Jun 01 2020

Formula

a(n) = 2 * A047160(n). - Alois P. Heinz, Jun 01 2020

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

A075409 a(n) is the smallest m such that n!-m and n!+m are both primes.

Original entry on oeis.org

0, 1, 5, 7, 19, 19, 31, 17, 11, 17, 83, 67, 353, 227, 163, 59, 61, 113, 353, 31, 1447, 571, 389, 191, 337, 883, 101, 1823, 659, 709, 163, 1361, 439, 307, 1093, 1733, 2491, 1063, 1091, 1999, 1439, 109, 2753, 607, 2617, 269, 103, 2663, 337, 14447, 2221, 5471, 2887
Offset: 2

Views

Author

Zak Seidov, Sep 18 2002

Keywords

Comments

For n=3,5,10,21,171,190,348, n! is an interprime, the average of two consecutive primes, see A053709. In general n! may be average of several pairs of primes, in which case the minimal distance is in the sequence. See also n^n and n!! as average of two primes in A075468 and A075410.
According to Goldbach's conjecture, a(n) always exists with a(n) = A047160(n!). - Jens Kruse Andersen, Jul 30 2014

Examples

			a(4)=5 because 4!=24 and 19 and 25 are primes with smallest distance 5 from 4!.
		

Crossrefs

Programs

  • Mathematica
    smp[n_]:=Module[{m=1,nf=n!},While[!PrimeQ[nf+m]||!PrimeQ[nf-m],m=m+2];m]; Join[{0},Array[smp,60,3]] (* Harvey P. Dale, Apr 18 2014 *)
  • PARI
    a(n) = {my (m=0); until (ok, ok = isprime(n!-m) && isprime(n!+m); if (!ok, m++);); return (m);} \\ Michel Marcus, Apr 19 2013

Extensions

More terms from David Wasserman, Jan 17 2005

A103147 Least k such that k+n and k-n are both prime but k-m and k+m are not both prime for any 0 <= m < n.

Original entry on oeis.org

2, 4, 9, 8, 27, 24, 25, 54, 51, 22, 117, 222, 49, 114, 87, 46, 207, 216, 121, 258, 291, 128, 591, 336, 203, 306, 423, 136, 519, 492, 221, 888, 951, 146, 537, 318, 527, 1656, 561, 238, 699, 732, 265, 864, 1365, 286, 1353, 1674, 341, 1422, 1671, 802, 2451, 876, 553
Offset: 0

Views

Author

Lei Zhou, Jan 26 2005

Keywords

Comments

First appearance of n in A047160.
It appears that a(3n) is less than a(3n-1) and a(3n+1) for all n except 2 and 12. The lower and upper primes are A155766(n) and A155767(n). - T. D. Noe, Jan 26 2009
No odd primes are in this sequence. - Lei Zhou, Mar 06 2012

Examples

			a(0)=2 because 2-0 and 2+0 are primes. 2 is the least such value.
a(1)=4 because 4-1 and 4+1 are prime, but 4-0 and 4-0 are not prime. 4 is the least such value.
a(2)=9 because 9-2 and 9+2 are prime, but (8,10) and (9,9) are not prime pairs. 9 is the least such value.
a(3)=8 because 8-3 and 8+3 are prime, but (6,10), (7,9) and (8,8) are not prime pairs. 8 is the least such value.
a(11)=222 because 211 and 233 are prime, but (222-m,222+m) is not a prime pair for any m<11. 222 is the least such value.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a103147 = (+ 2) . fromJust . (`elemIndex` a047160_list)
    -- Reinhard Zumkeller, Aug 10 2014
  • Mathematica
    primePairQ[k_, n_] := PrimeQ[k+n]&&PrimeQ[k-n]; SetAttributes[primePairQ, Listable]; Table[k=n+2; While[ !primePairQ[k, n] || (Or@@primePairQ[k, Range[0, n-1]]), k++ ]; k, {n, 0, 55}]

Extensions

Edited by Ray Chandler and T. D. Noe, Feb 01 2005

A325142 a(n) = k if (n - k, n + k) is the centered Goldbach partition of 2n if it exists and -1 otherwise.

Original entry on oeis.org

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

Views

Author

Peter Luschny, May 02 2019

Keywords

Comments

Let N = 2*n = p + q where p and q are primes. We call such a pair (p, q) a Goldbach partition of N. A centered Goldbach partition is the Goldbach partition of the form (n - k, n + k) where k >= 0 is minimal. If N has a centered Goldbach partition then a(n) is this k and otherwise -1.
According to Goldbach's conjecture, any even N = 2n > 2 has a Goldbach partition, which is necessarily of the form p = n - k, q = n + k: namely, with n = (p+q)/2 and k = (q-p)/2. - M. F. Hasler, May 02 2019

Examples

			a(162571) = 78 because 325142 = 162493 + 162649 and there is no k, 0 <= k < 78, such that (162571 - k, 162571 + k) is a Goldbach partition of 325142.
		

Crossrefs

Programs

  • Maple
    a := proc(n) local k; for k from 0 to n do
    if isprime(n + k) and isprime(n - k) then return k fi od: -1 end:
    seq(a(n), n=0..83);
  • Mathematica
    a[n_] := Module[{k}, For[k = 0, k <= n, k++, If[PrimeQ[n+k] && PrimeQ[n-k], Return[k]]]; -1]; Table[a[n], {n, 0, 83}] (* Jean-François Alcover, Jul 06 2019, from Maple *)
  • PARI
    a(n) = for(k=0, n, if(ispseudoprime(n+k) && ispseudoprime(n-k), return(k))); -1 \\ Felix Fröhlich, May 02 2019
    
  • PARI
    apply( A325142(n)=-!forprime(p=n,2*n, isprime(n*2-p)&&return(p-n)), [0..99]) \\ M. F. Hasler, May 02 2019

Formula

a(n) = n - A112823(n) = A234345(n) - n (= n - A002374(n) for n > 2). - M. F. Hasler, May 02 2019
a(n) = A047160(n) = A066285(n)/2 for n >= 2. - Alois P. Heinz, Jun 01 2020

A177461 The smallest k such that Fibonacci(n)+k and Fibonacci(n)-k are both prime.

Original entry on oeis.org

0, 0, 0, 3, 0, 2, 3, 12, 0, 5, 0, 24, 3, 4, 0, 33, 48, 28, 57, 192, 0, 31, 12, 60, 81, 28, 0, 177, 108, 50, 345, 150, 168, 35, 6, 618, 735, 76, 18, 147, 0, 134, 111, 126, 0, 85, 642, 1146, 225, 92, 480, 219, 348, 466, 345, 72, 300, 89, 90, 312, 2025, 664, 168, 945, 276, 128
Offset: 3

Views

Author

Keywords

Comments

Indices where a(n)= 0 are provided by A001605.

Examples

			3 +- 0 -> primes, 5 +- 0 -> primes, 8 +- 3 -> primes, 13 +- 0 -> primes, 21 +- 2 -> primes, ...
		

Crossrefs

Programs

  • Maple
    A047160 := proc(n) for k from 0 to n-1 do if isprime(n-k) and isprime(n+k) then return k; end if; end do: return -1 ; end proc:
    A177461 := proc(n) A047160(combinat[fibonacci](n)) ; end proc: # R. J. Mathar, Jan 23 2011
  • Mathematica
    f[n_] := Block[{k}, If[n==2||OddQ[n], k=0, k=1]; While[!PrimeQ[n-k] || !PrimeQ[n+k], k+=2]; k]; Table[f[Fibonacci[n]], {n,3,100}]

Formula

a(n) = A047160(A000045(n)). - R. J. Mathar, Jan 23 2011

A177463 The smallest k such that Catalan(n)+k and Catalan(n)-k are both prime.

Original entry on oeis.org

0, 3, 1, 5, 10, 3, 69, 33, 45, 45, 9, 47, 86, 97, 97, 41, 19, 49, 191, 11, 101, 283, 1, 69, 597, 549, 1341, 243, 552, 121, 157, 115, 1341, 1905, 165, 597, 27, 87, 31, 731, 1093, 449, 127, 37, 37, 157, 1145, 587, 317, 659, 1523, 487, 865, 4879, 463, 1351, 4471
Offset: 3

Views

Author

Keywords

Examples

			5 +- 0 -> primes, 14 +- 3 -> primes, 42 +- 1 -> primes, 132 +- 5 -> primes, ...
		

Crossrefs

Programs

  • Maple
    A000108 := proc(n) binomial(2*n,n)/(n+1) ; end proc:
    A047160 := proc(n) for k from 0 to n-1 do if isprime(n-k) and isprime(n+k) then return k; end if; end do: return -1 ; end proc:
    A177463 := proc(n) A047160(A000108(n)) ; end proc:
    seq(A177463(n),n=3..40) ; # R. J. Mathar, Jan 23 2011
  • Mathematica
    g[n_]:=(2n)!/n!/(n+1)!; f[n_]:=Block[{k},If[OddQ[n],k=0,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k],k+=2];k]; Table[f[g[n]],{n,3,4*4!}]

Formula

a(n) = A047160(A000108(n)). - R. J. Mathar, Jan 23 2011

A336585 Integers m such that (m-d)*(m+d) < (m-1)^2, where d is the smallest number such that both m-d and m+d are primes.

Original entry on oeis.org

22, 28, 32, 38, 46, 49, 55, 58, 68, 74, 82, 87, 94, 112, 121, 128, 130, 136, 146, 155, 184, 200, 203, 206, 218, 221, 224, 238, 244, 247, 253, 265, 268, 284, 286, 301, 304, 306, 308, 316, 318, 320, 323, 326, 341, 344, 346, 362, 398, 412, 413, 428, 454, 466, 484
Offset: 1

Views

Author

Ya-Ping Lu, Oct 04 2020

Keywords

Comments

All terms in this sequence are composites since, if m is a prime, d = 0 and (m-d)*(m+d) = m^2 > (m-1)^2.
It seems that the number of terms in this sequence is finite, with the last term being a(1225) = 1353559. Conjecture: there exist only 1225 semiprimes of the form (m-d)*(m+d), where d is the smallest number such that (m-d)*(m+d) < (m-1)^2.
a(n) in this sequence is the value of n in A047160 with m > sqrt(2*n - 1).
All terms <= 1353559 in A335297 can be found in this sequence.

Examples

			2 is not a term since for m = 2, d = 0 and (2-0)*(2-0) = 4 > (m-1)^2 = 1;
4 is not a term since for m = 4, d = 1 and (4-1)*(4+1) = 15 > (m-1)^2 = 9;
22 is a term since for m = 22, d = 9 and (22-9)*(22+9) = 403 < (m-1)^2 = 441;
1353559 is a term since for m = 1353559, d = 1722 and (1353559-1722)*(1353559+1722) = 1832119001197 < (m-1)^2 = 1832119259364.
		

Crossrefs

Programs

  • Python
    from sympy import isprime
    n = 0
    m = 2
    while m >= 2:
        d = 0
        while d < m/2:
            p = m - d
            q = m + d
            if isprime(p) == 1 and isprime(q) == 1:
                if p*q < (m - 1) * (m - 1):
                    n += 1
                    print (m)
                break
            d += 1
        m += 1
Previous Showing 11-18 of 18 results.