login
Primes that remain prime through 3 iterations of the function f(x) = 2*x + 1.
35

%I #44 Sep 08 2022 08:44:47

%S 2,5,89,179,359,509,1229,1409,2699,3539,6449,10589,11549,11909,12119,

%T 17159,19709,19889,22349,26189,27479,30389,43649,53639,53849,55229,

%U 57839,60149,61409,63419,66749,71399,74699,75329,82499,87539,98369,101399,104369

%N Primes that remain prime through 3 iterations of the function f(x) = 2*x + 1.

%C Primes p such that 2*p+1, 4*p+3 and 8*p+7 are also primes. - _Vincenzo Librandi_, Aug 04 2010

%C For n > 2, a(n) == 29 (mod 30). - _Zak Seidov_, Jan 31 2013

%H Nathaniel Johnston, <a href="/A023272/b023272.txt">Table of n, a(n) for n = 1..1000</a>

%p p:=2: for n from 1 to 5000 do if(isprime(2*p+1) and isprime(4*p+3) and isprime(8*p+7))then printf("%d, ",p): fi: p:=nextprime(p): od: # _Nathaniel Johnston_, Jun 30 2011

%t Select[Prime[Range[10^3*4]], PrimeQ[a1=2*#+1] && PrimeQ[a2=2*a1+1] && PrimeQ[a3=2*a2+1] &] (* _Vladimir Joseph Stephan Orlovsky_, May 01 2008 *)

%t Join[{2, 5}, Select[Range[89, 104369, 30], PrimeQ[#] && PrimeQ[2*# + 1] && PrimeQ[4*# + 3] && PrimeQ[8*# + 7] &]] (* _Zak Seidov_, Jan 31 2013 *)

%t p3iQ[n_]:=AllTrue[NestList[2#+1&,n,3],PrimeQ]; Join[{2,5},Select[ Range[ 89,200000,30],p3iQ]] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Mar 30 2019 *)

%o (Magma) [n: n in [1..100000] | IsPrime(n) and IsPrime(2*n+1) and IsPrime(4*n+3) and IsPrime(8*n+7)] // _Vincenzo Librandi_, Aug 04 2010

%o (PARI) is(n)=isprime(n)&&isprime(2*n+1)&&isprime(4*n+3)&&isprime(8*n+7) \\ _Charles R Greathouse IV_, Mar 21 2013

%Y Intersection of A007700 and A023231.

%Y Cf. A005384, A005385, A023302, A023330, A057331, A005602.

%K nonn

%O 1,1

%A _David W. Wilson_