OFFSET
1,1
COMMENTS
A005385 is a subsequence: f(x) is applied just once.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(5) = f(f(7)) = (7*2 + 1)*2 + 1 = 31.
a(48) = f(f(f(137))) = ((137*2 + 1)*2 + 1)*2 + 1 = 1103.
MAPLE
N:= 10^4: # to get all terms <= N
Primes:= select(isprime, {2, seq(i, i=3..N, 2)}):
f:= x -> 2*x+1:
S:= {}: R:= Primes:
for k from 1 while nops(R) > 0 do
R:= select(`<=`, map(f, R), N);
S:= S union (R intersect Primes);
od:
sort(convert(S, list)); # Robert Israel, Jun 29 2016
MATHEMATICA
Take[Select[Union@ Flatten[Table[Nest[2 # + 1 &, Prime@ n, #], {n, 120}] & /@ Range@ 120], PrimeQ], 53] (* Michael De Vlieger, Jan 06 2016 *)
PROG
(Python)
from sympy import isprime
a=[]
TOP=10000
for p in range(TOP):
if isprime(p):
while p<TOP:
p = p*2+1
if isprime(p): a.append(p)
print(sorted(set(a)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Dec 25 2015
STATUS
approved