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.
%I A213982 #61 May 15 2025 08:18:14 %S A213982 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,2,1,1,3,1,2, %T A213982 1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,2,1,2,2,3,1,1,1,1,1,2,1,1,3,2,1,1,1,3, %U A213982 1,2,1,1,1,3 %N A213982 Least k >= 1 such that prime(n) +- k = 2^m * q, m >= 0, where q >= 2 is prime. %C A213982 What can one say about the average behavior of a(n) for large n? It is interesting in view of the Broughan-Qizhi inequality A192869(n) >> n*(log(n))^2 and their conjecture that A192869(n) = O(n*(log(n))^2). But in the case of A213982 we have, on average, log(n) possible odd positive and negative values of k with |k| < min(prime(n)-prime(n-1), prime(n+1)-prime(n)) which is approximately log(n). %C A213982 Therefore, we conjecture that, on average, a(n) is approximately c*log(n) with c in (0,1). Calculations up to 10^6 (_Peter J. C. Moses_) show that, most likely, c < 0.298. %H A213982 Robert Israel, <a href="/A213982/b213982.txt">Table of n, a(n) for n = 1..10000</a> %H A213982 Kevin Broughan and Zhou Qizhi, <a href="https://doi.org/10.1017/S0004972710000067">Flat primes and thin primes</a>, Bulletin of the Australian Mathematical Society 82:2 (2010), pp. 282-292. %e A213982 a(1) = 1, since 2+1 = 3 = 2^0*3; %e A213982 a(2) = 1, since 3+1 = 2^1*2; %e A213982 a(7) = 1, since 17-1 = 16 = 2^3*2; %e A213982 a(10) = 1, since 29-1 = 28 = 2^2*7. %p A213982 f:= proc(n) local p, q,k,t; %p A213982 p:= ithprime(n); %p A213982 for k from 1 do %p A213982 for t in [p+k,p-k] do %p A213982 q:= t/2^padic:-ordp(t,2); %p A213982 if q=1 or isprime(q) then return k fi %p A213982 od %p A213982 od %p A213982 end proc: %p A213982 map(f, [$1..100]); # _Robert Israel_, Mar 27 2018 %t A213982 Table[NestWhile[#+1&, 1, Not[Apply[Or, Flatten[PrimeQ[Map[(Prime[n] + #)/(2^Range[0, Floor[Log[Prime[n]]/Log[2]]])&,{-#,#}]]]]]&], {n, 100}] (* _Peter J. C. Moses_, Jul 09 2012 *) %Y A213982 Cf. A192869, A214018. %K A213982 nonn %O A213982 1,20 %A A213982 _Vladimir Shevelev_, Jun 30 2012 %E A213982 Name edited by _Robert Israel_, Mar 28 2018