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.

This page as a plain text file.
%I A051729 #17 Jul 06 2025 12:06:28
%S A051729 1,26,118,120,532,1140,1340,1342,1344,15702,15704,19632,19634,31424,
%T A051729 31426,31428,31430,31432,155958,155960,155962,155964,360698,360700,
%U A051729 370310,370312,370314,370316,492170,1349592,1357262,1357264,1357266,2010800,2010802,2010804,2010806
%N A051729 Smallest number at distance 2n+1 from nearest prime.
%F A051729 a(n) = A051652(2*n+1). - _Sean A. Irvine_, Oct 01 2021
%t A051729 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 *)
%t A051729 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 *)
%Y A051729 Related sequences: A023186-A023188, A046929-A046931, A051650, A051652, A051697-A051702, A051728-A051730.
%K A051729 nonn,easy,nice
%O A051729 0,2
%A A051729 _N. J. A. Sloane_
%E A051729 More terms from _James Sellers_, Dec 07 1999
%E A051729 More terms from _Amiram Eldar_, Aug 28 2021