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.

A280941 Least integer k such that prime(k+1) - prime(k) = 2 and prime(k+2) - prime(k+1) = 2n, or 0 if no such k exists.

Original entry on oeis.org

2, 3, 10, 0, 33, 45, 0, 294, 98, 0, 296, 262, 0, 428, 984, 0, 1456, 3086, 0, 2343, 1878, 0, 14938, 8422, 0, 2809, 4259, 0, 7809, 13819, 0, 51036, 45506, 0, 15782, 30764, 0, 57764, 24553, 0, 23282, 51942, 0, 44902, 34214, 0, 1242641, 95929, 0, 66761
Offset: 1

Views

Author

Michel Lagneau, Jan 11 2017

Keywords

Comments

Or least integer k such that prime(k+2) - prime(k+1) = 2n where prime(k) is in A001359 (lesser of twin primes).
The corresponding prime(k) are 3, 5, 29, 137, 197, 1931, 521, 1949, 1667, 2969, 7757, 12161, 28349, 20807, ...
a(n) is a subsequence of A029707(n) or subsequence of A107770(n) - 1.
a(n) = 0 for n == 1 mod 3 for n > 1.
Proof: prime(k+1) - prime(k) = 2 => prime(k+1) == 1 mod 6 and prime(k) == -1 mod 6. If prime(k+2) - prime(k+1) = 2n, then prime(k+2) = 2(n+1) + prime(k). Combining n == 1 mod 3 and prime(k) == -1 mod 6 we obtain prime(k+2) == 3 mod 6, a contradiction because prime(k+2) == +-1 mod 6. Hence, a(n) = 0.

Examples

			a(3) = 10 because prime(11) - prime(10) = 31 - 29 = 2 and prime(12) - prime(11) = 37 - 31 = 6 = 2*3.
a(11) = 296 because prime(297) - prime(296) = 1951 - 1949 = 2 and prime(298) - prime(297) = 1973 - 1951 = 22 = 2*11.
		

Crossrefs

Programs

  • Maple
    nn:=50:m:=10^5:
    for n from 1 to 50 do:
    ii:=0:
      for k from 1 to m while(ii=0) do:
       p1:=ithprime(k):p2:=ithprime(k+1):p3:=ithprime(k+2):
        if p2-p1 = 2 and p3-p2 = 2*n
        then
        ii:=1:printf(`%d %d \n`,n,k):
        else
        fi:
       od:
        if ii=0 then printf(`%d %d \n`,n,0):
        else
        fi:
    od:
  • Mathematica
    Table[If[And[n > 1, Mod[n, 3] == 1], 0, k = 1; While[Nand[# - Prime@ k == 2, Prime[k + 2] - # == 2 n] &@ Prime[k + 1], k++]; k], {n, 40}] (* Michael De Vlieger, Jan 14 2017 *)