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.

A051729 Smallest number at distance 2n+1 from nearest prime.

Original entry on oeis.org

1, 26, 118, 120, 532, 1140, 1340, 1342, 1344, 15702, 15704, 19632, 19634, 31424, 31426, 31428, 31430, 31432, 155958, 155960, 155962, 155964, 360698, 360700, 370310, 370312, 370314, 370316, 492170, 1349592, 1357262, 1357264, 1357266, 2010800, 2010802, 2010804, 2010806
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    seq[max_] := Module[{s = Table[0, {max}], c = 1, n = 4}, s[[1]] = 1; While[c < max, i = (Min[n - NextPrime[n, -1], NextPrime[n] - n] + 1)/2; If[i <= max && s[[i]] == 0, c++; s[[i]] = n]; n += 2]; s] ; seq[20] (* Amiram Eldar, Aug 28 2021 *)
    With[{tbl=Table[{n,If[PrimeQ[n],2,Min[n-NextPrime[n,-1],NextPrime[n]-n]]},{n,500000}]},Table[SelectFirst[tbl,#[[2]]==2k+1&],{k,0,28}]][[;;,1]] (* The program generates the first 29 terms of the sequence. *) (* Harvey P. Dale, Jul 06 2025 *)

Formula

a(n) = A051652(2*n+1). - Sean A. Irvine, Oct 01 2021

Extensions

More terms from James Sellers, Dec 07 1999
More terms from Amiram Eldar, Aug 28 2021