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.

A132861 Smallest number at distance 3n from nearest prime (variant 2).

This page as a plain text file.
%I A132861 #17 Feb 28 2021 12:05:46
%S A132861 2,26,53,532,211,1342,2179,15704,16033,31424,24281,31430,31433,155960,
%T A132861 58831,360698,206699,370312,370315,492170,1357261,1357264,1357267,
%U A132861 2010802,2010805,4652428,12485141,17051788,17051791,17051794,11117213,20831416,10938023,20831422
%N A132861 Smallest number at distance 3n from nearest prime (variant 2).
%C A132861 Let f(m) be the distance to the nearest prime as defined in A051700(m). Then a(n) = min {m: f(m) = 3n} for n > 0. A132470 uses A051699(m) to define the distance. a(n) <= A132470(n) because here primes at the start or end of a prime gap of size 3n may be picked, which would be discarded in A132470 for n>0; this gives a chance to minimize m here further than in A132470.
%H A132861 Michael S. Branicky, <a href="/A132861/b132861.txt">Table of n, a(n) for n = 0..76</a>
%H A132861 Michael S. Branicky, <a href="/A132861/a132861.py.txt">Python program</a>
%F A132861 a(n) = min {m : A051700(m) = 3n} for n > 0.
%F A132861 a(n) = A051652(3*n). [From _R. J. Mathar_, Jul 22 2009]
%p A132861 A051700 := proc(m) if m <= 2 then op(m+1,[2,1,1]) ; else min(nextprime(m)-m,m-prevprime(m)) ; fi ; end: a := proc(n) local m ; if n = 0 then RETURN(2); else for m from 0 do if A051700(m) = 3 * n then RETURN(m) ; fi ; od: fi ; end: seq(a(n),n=0..18);
%o A132861 (Python) # see link for faster program
%o A132861 from sympy import prevprime, nextprime
%o A132861 def A051700(n):
%o A132861   return [2, 1, 1][n] if n < 3 else min(n-prevprime(n), nextprime(n)-n)
%o A132861 def a(n):
%o A132861   if n == 0: return 2
%o A132861   m = 0
%o A132861   while A051700(m) != 3*n: m += 1
%o A132861   return m
%o A132861 print([a(n) for n in range(13)]) # _Michael S. Branicky_, Feb 26 2021
%Y A132861 Cf. A132470, A051700.
%K A132861 nonn
%O A132861 0,1
%A A132861 _R. J. Mathar_, Nov 18 2007
%E A132861 7 more terms from _R. J. Mathar_, Jul 22 2009
%E A132861 4 more terms from _R. J. Mathar_, Aug 21 2018
%E A132861 a(30) and beyond and edits from _Michael S. Branicky_, Feb 26 2021