%I #32 Sep 24 2024 14:52:31
%S 2,1644103,3892831,5178193,5497949,5657699,11078437,13379917,14471147,
%T 14890693,19861879,25219343,27671803,28012511,29878997,31848277,
%U 32550769,34190399,40630441,42081719,47187919,53964661,54795553,55912781,59327927,64749281,68818993
%N Primes p such that q = p^2 - 2, r = q^2 - 2, s = r^2 - 2 and t = s^2 - 2 are all prime.
%C Subsequence of A257552, A257551 and A062326.
%H Chai Wah Wu, <a href="/A253264/b253264.txt">Table of n, a(n) for n = 1..1000</a>
%t Select[Prime@Range@6000000, PrimeQ[#^2 - 2] && PrimeQ[#^4 - 4 #^2 + 2] && PrimeQ[#^8 - 8 #^6 + 20 #^4 - 16 #^2 + 2] && PrimeQ[(#^8 - 8 #^6 + 20 #^4 - 16 #^2 + 2)^2 - 2] &] (* _Vincenzo Librandi_, May 01 2015 *)
%t apQ[p_]:=Module[{q=p^2-2,r,s},r=q^2-2;s=r^2-2;AllTrue[ {q,r,s,s^2-2},PrimeQ]]; Select[Prime[Range[4053000]],apQ] (* _Harvey P. Dale_, Mar 27 2022 *)
%o (Magma) [p: p in PrimesUpTo(2*10^7) | IsPrime(p^2-2) and IsPrime(p^4-4*p^2+2) and IsPrime(p^8-8*p^6+20*p^4-16*p^2+2) and IsPrime((p^8-8*p^6+20*p^4-16*p^2+2)^2-2)]; // _Vincenzo Librandi_, May 01 2015
%o (Python)
%o from gmpy2 import is_prime, next_prime
%o A253264_list, p = [], 2
%o for _ in range(10**7):
%o q = p**2 - 2
%o if is_prime(q):
%o r = q**2 -2
%o if is_prime(r):
%o s = r**2-2
%o if is_prime(s) and is_prime(s**2-2):
%o A253264_list.append(p)
%o p = next_prime(p) # _Chai Wah Wu_, May 02 2015
%o (Perl) use Math::GMP ":constant"; use ntheory ":all"; my($q,$r,$s,$t); forprimes { say if is_prime($q=$_**2-2) && is_prime($r=$q**2-2) && is_prime($s=$r**2-2) && is_prime($t=$s**2-2); } 1e12; # _Dana Jacobsen_, May 02 2015
%Y Cf. A062326, A257551, A257552.
%K nonn
%O 1,1
%A _Zak Seidov_, Apr 30 2015
%E First term and additional terms added from _Vincenzo Librandi_, May 01 2015