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.

A358974 a(n) is the least prime p such that q-p = n*(r-q) where p,q,r are consecutive primes.

Original entry on oeis.org

3, 7, 23, 6397, 139, 509, 84871, 1933, 1259, 43331, 1129, 4523, 933073, 2971, 6917, 1568771, 9973, 32261, 4131109, 25261, 78737, 12809359, 91033, 28229, 13626257, 35677, 117443, 37305713, 399793, 102701, 217795247, 288583, 296843, 240485257, 173359, 1025957, 213158279, 1053103, 370949, 1163010181
Offset: 1

Views

Author

Keywords

Comments

a(n) = prime(k) for the first k such that A001223(k) = n*A001223(k+1).

Examples

			a(3) = 23 because 23, 29, 31 are consecutive primes with 29-23 = 3*(31-29) and 23 is the first prime that works.
		

Crossrefs

Programs

  • Maple
    V:= Vector(45): count:= 0:
    q:= 2: r:= 3:
    while count < 45 do
      p:= q; q:= r; r:= nextprime(r);
      v:= (q-p)/(r-q);
      if v::integer and v <= 45 and V[v] = 0 then
        count:= count+1; V[v]:= p;
      fi
    od:
    convert(V,list);
  • Python
    from sympy import nextprime
    from itertools import count, islice
    def agen():
        p, q, r, n, adict = 2, 3, 5, 1, dict()
        while True:
            v, rem = divmod(q-p, r-q)
            if rem == 0 and v not in adict: adict[v] = p
            while n in adict: yield adict[n]; n += 1
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 21))) # Michael S. Branicky, Dec 07 2022