Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #38 Jan 13 2023 16:50:10
%S 281683,496789,823421,1352753,1719217,6174109,8643149,9761051,9843529,
%T 16191167,19132121,19745797,23490473,28457797,31820429,32860271,
%U 36552277,37068569,43506569,44776981,46808903,55035047,55957807,67194403,75099137,83092897,86580421,89135089
%N Prime numbers P such that Q=2*P^2-1, R=2*Q^2-1, S=2*R^2-1 and T=2*S^2-1 are all prime numbers.
%C Subsequence of A106483.
%C For P = 496789, 83092897, 467014643, U=2*T^2-1 is also prime. [Corrected by _Jens Kruse Andersen_, Aug 21 2014]
%H Pierre CAMI, <a href="/A245659/b245659.txt">Table of n, a(n) for n = 1..140</a>
%e 281683 is prime P.
%e Q=2*P^2-1 = 158690624977 is prime Q.
%e R=2*Q^2-1 = 50365428911181712501057 is prime R.
%e S=2*R^2-1 = 5073352858814597404058971422301788780452234497 is prime S.
%e T=2*S^2-1 = 51477818460084496601334991724899650493354568309112026195311592373475872924903206720553686017 is prime T.
%e U=2*T^2-1 is composite.
%t f[n_]:=2n^2-1;Select[Prime[Range[5170000]],PrimeQ[f[#]]&&PrimeQ[f[f[#]]]&&PrimeQ[f[f[f[#]]]]&&PrimeQ[f[f[f[f[#]]]]]&] _Farideh Firoozbakht_, Aug 11 2014
%t Select[Prime[Range[52*10^5]],AllTrue[Rest[FoldList[2#^2-1&,{#,#,#,#,#}]],PrimeQ]&] (* _Harvey P. Dale_, Jan 13 2023 *)
%o (PFGW & SCRIPT)
%o SCRIPT
%o DIM i
%o DIM j
%o DIM k
%o DIM n,0
%o DIMS t
%o OPENFILEOUT myf,a(n).txt
%o LABEL loop1
%o SET n,n+1
%o SETS t,%d,%d\,;n;p(n)
%o PRP 2*p(n)^2-1,t
%o IF ISPRP THEN GOTO a
%o GOTO loop1
%o LABEL a
%o SET i,2*p(n)^2-1
%o PRP 2*i^2-1,t
%o IF ISPRP THEN GOTO b
%o GOTO loop1
%o LABEL b
%o SET j,2*i^2-1
%o PRP 2*j^2-1,t
%o IF ISPRP THEN GOTO c
%o GOTO loop1
%o LABEL c
%o WRITE myf,t
%o SET k,2*j^2-1
%o PRP 2*k^2-1
%o IF ISPRP THEN GOTO d
%o GOTO loop1
%o LABEL d
%o WRITE myf,t
%o GOTO loop1
%o (PARI)
%o f(x)=return(2*x^2-1)
%o forprime(p=1,10^8,if(ispseudoprime(f(p)) && ispseudoprime(f(f(p))) && ispseudoprime(f(f(f(p)))) && ispseudoprime(f(f(f(f(p))))), print1(p,", "))) \\ _Derek Orr_, Jul 28 2014
%Y Cf. A106483.
%K nonn
%O 1,1
%A _Pierre CAMI_, Jul 28 2014
%E More terms from _Derek Orr_, Jul 28 2014