login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Prime powers k such that k - 2 and k + 2 are prime powers.
2

%I #28 Sep 08 2022 08:46:14

%S 3,5,7,9,11,25,27,29,81,241,59051,450283905890997361,

%T 36472996377170786401

%N Prime powers k such that k - 2 and k + 2 are prime powers.

%C From _Robert Israel_, Nov 22 2015: (Start)

%C a(14) > 3^1000 - 2 if it exists.

%C One of a(n), a(n)+2 and a(n)-2 must be a power of 3. (End)

%e 81 is in this sequence because 81 - 2 = 79, 81 and 81 + 2 = 83 are all prime powers.

%p ispp:= proc(x) local p, r;

%p if isprime(x) then return true fi;

%p p:= 2;

%p do

%p r:= iroot(x,p);

%p if r^p = x then return isprime(r) fi;

%p if r < 2 then return false fi;

%p p:= nextprime(p);

%p od:

%p end proc:

%p ispp(1):= true:

%p A:= NULL;

%p for n from 1 to 1000 do

%p B:= map(ispp, [3^n-4,3^n-2,3^n+2,3^n+4]);

%p if B[1] and B[2] then A:= A, 3^n-2 fi;

%p if B[2] and B[3] then A:= A, 3^n fi;

%p if B[3] and B[4] then A:= A, 3^n+2 fi;

%p od:

%p A; # _Robert Israel_, Nov 22 2015

%t Prepend[Select[Range@ 100000, AllTrue[{# - 2, #, # + 2}, PrimePowerQ] &], 3] (* _Michael De Vlieger_, Dec 03 2015, Version 10 *)

%o (Magma) [n: n in [5..100000] | IsPrimePower(n-2) and IsPrimePower(n) and IsPrimePower(n+2)];

%o (PARI) is(k) = isprimepower(k) || k==1;

%o for(k=1, 1e6, if(is(k) && is(k+2) && is(k-2), print1(k, ", "))) \\ _Altug Alkan_, Nov 22 2015

%Y Cf. A000961, A144234, A264744.

%K nonn,more

%O 1,1

%A _Juri-Stepan Gerasimov_, Nov 22 2015

%E a(12) and a(13) from _Robert Israel_, Nov 22 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 22:57 EDT 2024. Contains 376090 sequences. (Running on oeis4.)