login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Primes representable as f(f(f(...f(p)...))) where p is a prime and f(x) = x*2 + 1.
4

%I #23 May 04 2021 17:41:27

%S 5,7,11,23,31,47,59,71,79,83,107,127,151,167,179,191,223,227,239,263,

%T 271,347,359,383,431,439,467,479,503,563,587,599,607,631,719,727,839,

%U 863,887,911,919,967,983,991,1019,1031,1087,1103,1151,1187,1231,1279,1283

%N Primes representable as f(f(f(...f(p)...))) where p is a prime and f(x) = x*2 + 1.

%C A005385 is a subsequence: f(x) is applied just once.

%H Robert Israel, <a href="/A266233/b266233.txt">Table of n, a(n) for n = 1..10000</a>

%e a(5) = f(f(7)) = (7*2 + 1)*2 + 1 = 31.

%e a(48) = f(f(f(137))) = ((137*2 + 1)*2 + 1)*2 + 1 = 1103.

%p N:= 10^4: # to get all terms <= N

%p Primes:= select(isprime, {2,seq(i,i=3..N,2)}):

%p f:= x -> 2*x+1:

%p S:= {}: R:= Primes:

%p for k from 1 while nops(R) > 0 do

%p R:= select(`<=`,map(f,R),N);

%p S:= S union (R intersect Primes);

%p od:

%p sort(convert(S,list)); # _Robert Israel_, Jun 29 2016

%t Take[Select[Union@ Flatten[Table[Nest[2 # + 1 &, Prime@ n, #], {n, 120}] & /@ Range@ 120], PrimeQ], 53] (* _Michael De Vlieger_, Jan 06 2016 *)

%o (Python)

%o from sympy import isprime

%o a=[]

%o TOP=10000

%o for p in range(TOP):

%o if isprime(p):

%o while p<TOP:

%o p = p*2+1

%o if isprime(p): a.append(p)

%o print(sorted(set(a)))

%Y Cf. A000040, A005385, A266234, A266235.

%K nonn

%O 1,1

%A _Alex Ratushnyak_, Dec 25 2015