OFFSET
0,1
COMMENTS
(+/-) distance from 5^n to the nearest semiprime.
a(0)=3 and a(1)=-1 are the only terms == 3 (mod 4), as 5^n + 3 is divisible by 4. - Robert Israel, May 03 2018
LINKS
Robert Israel, Table of n, a(n) for n = 0..111
FORMULA
EXAMPLE
a(0) = 3 because 5^0 + 3 = 4 = A001358(1) and no semiprime is closer to 5^0.
a(1) = -1 because 5^1 - 1 = 4 = A001358(1) and no semiprime is closer to 5^1.
a(2) = 0 because 5^2 + 0 = 25 = A001358(9), no semiprime is closer to 5^2 [this is the only 0 element].
a(3) = -2 because 5^3 - 2 = 123 = 3 * 41 = A001358(42), no semiprime is closer.
a(4) = 1 because 5^4 + 1 = 626 = 2 * 313, no semiprime is closer.
a(5) = 2 because 5^5 + 2 = 3127 = 53 * 59, no semiprime is closer.
MAPLE
nsp:= proc(n) uses numtheory; local k;
if bigomega(n)=2 then return n fi;
for k from 1 do
if n-k > 0 and bigomega(n-k)=2 then return n-k fi;
if bigomega(n+k)=2 then return n+k fi
od
end proc:
seq(nsp(5^n)-5^n, n=0..30); # Robert Israel, May 03 2018
MATHEMATICA
nsp[n_] := Module[{k}, If[PrimeOmega[n] == 2, Return[n]]; For[k = 1, True, k++, If[n-k > 0 && PrimeOmega[n-k] == 2, Return[n-k]]; If[PrimeOmega[n+k] == 2, Return[n+k]]]];
a[n_] := a[n] = nsp[5^n] - 5^n;
Table[Print[n, " ", a[n]]; a[n], {n, 0, 76}] (* Jean-François Alcover, Jul 23 2020, after Maple *)
CROSSREFS
KEYWORD
sign
AUTHOR
Jonathan Vos Post, Mar 14 2006
EXTENSIONS
More terms from Robert Israel, May 03 2018
STATUS
approved