A213982 Least k >= 1 such that prime(n) +- k = 2^m * q, m >= 0, where q >= 2 is prime.
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, 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, 1, 2, 1, 1, 1, 3
Offset: 1
Keywords
Examples
a(1) = 1, since 2+1 = 3 = 2^0*3; a(2) = 1, since 3+1 = 2^1*2; a(7) = 1, since 17-1 = 16 = 2^3*2; a(10) = 1, since 29-1 = 28 = 2^2*7.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Kevin Broughan and Zhou Qizhi, Flat primes and thin primes, Bulletin of the Australian Mathematical Society 82:2 (2010), pp. 282-292.
Programs
-
Maple
f:= proc(n) local p, q,k,t; p:= ithprime(n); for k from 1 do for t in [p+k,p-k] do q:= t/2^padic:-ordp(t,2); if q=1 or isprime(q) then return k fi od od end proc: map(f, [$1..100]); # Robert Israel, Mar 27 2018
-
Mathematica
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 *)
Extensions
Name edited by Robert Israel, Mar 28 2018
Comments