OFFSET
0,1
COMMENTS
EXAMPLE
a(0) = 3 because 2^0 + 3 = 4 = A001358(1) and no semiprime is closer to 2^0.
a(1) = 2 because 2^1 + 2 = 4 = A001358(1) and no semiprime is closer to 2^1.
a(2) = 0 because 2^2 + 0 = 4 = A001358(1) and no semiprime is closer to 2^2.
a(3) = 1 because 2^3 + 1 = 9 = 3^2 = A001358(3), no semiprime is closer to 2^3.
a(4) = -1 because 2^4 - 1 = 15 = 3 * 5 and no semiprime is closer.
a(5) = 1 because 2^5 + 1 = 33 = 3 * 11 and no semiprime is closer to 2^5.
a(6) = 1 because 2^6 + 1 = 65 = 5 * 13 and no semiprime is closer to 2^6.
a(7) = 1 because 2^7 + 1 = 129 = 3 * 43 and no semiprime is closer to 2^7.
a(8) = -2 because 2^8 - 2 = 254 = 2 * 127 and no semiprime is closer to 2^8.
MATHEMATICA
a[n_] := Catch@Block[{p = 2^n, k = 0}, While[True, If[p > k && PrimeOmega[p - k] == 2, Throw[-k]]; If[PrimeOmega[p + k] == 2, Throw[k]]; k++]]; a /@ Range[0, 80] a /@ Range[0, 80] (* Giovanni Resta, Jun 15 2016 *)
CROSSREFS
KEYWORD
easy,sign,less
AUTHOR
Jonathan Vos Post, Mar 13 2006
EXTENSIONS
Corrected and extended by Giovanni Resta, Jun 15 2016
STATUS
approved