A264734 Prime powers k such that k - 2 and k + 2 are prime powers.
3, 5, 7, 9, 11, 25, 27, 29, 81, 241, 59051, 450283905890997361, 36472996377170786401
Offset: 1
Examples
81 is in this sequence because 81 - 2 = 79, 81 and 81 + 2 = 83 are all prime powers.
Programs
-
Magma
[n: n in [5..100000] | IsPrimePower(n-2) and IsPrimePower(n) and IsPrimePower(n+2)];
-
Maple
ispp:= proc(x) local p, r; if isprime(x) then return true fi; p:= 2; do r:= iroot(x,p); if r^p = x then return isprime(r) fi; if r < 2 then return false fi; p:= nextprime(p); od: end proc: ispp(1):= true: A:= NULL; for n from 1 to 1000 do B:= map(ispp, [3^n-4,3^n-2,3^n+2,3^n+4]); if B[1] and B[2] then A:= A, 3^n-2 fi; if B[2] and B[3] then A:= A, 3^n fi; if B[3] and B[4] then A:= A, 3^n+2 fi; od: A; # Robert Israel, Nov 22 2015
-
Mathematica
Prepend[Select[Range@ 100000, AllTrue[{# - 2, #, # + 2}, PrimePowerQ] &], 3] (* Michael De Vlieger, Dec 03 2015, Version 10 *)
-
PARI
is(k) = isprimepower(k) || k==1; for(k=1, 1e6, if(is(k) && is(k+2) && is(k-2), print1(k, ", "))) \\ Altug Alkan, Nov 22 2015
Extensions
a(12) and a(13) from Robert Israel, Nov 22 2015
Comments