%I #13 May 10 2021 02:36:05
%S 5,101,677,28901,3422501,4884101,260176901,4784488901,5887492901,
%T 7370222501,12898144901,14498568101,24840912101,38514062501,
%U 47563248101,56249608901,64014060101,110842384901,123657722501,135755402501,205145584901,279343960901,288680544101
%N Primes representable as f(f(f(...f(p)...))) where p is a prime and f(x) = x^2 + 1.
%C For p>2, f(x) is applied an even number of times, twice at least.
%e a(2) = f(f(3)) = (3^2 + 1)^2 + 1 = 101.
%e a(3) = f(f(5)) = (5^2 + 1)^2 + 1 = 677.
%t Take[Union@ Flatten[Table[Nest[#^2 + 1 &, Prime@ n, #], {n, 150}] & /@ Range@ 6] /. n_ /; CompositeQ@ n -> Nothing, 23] (* _Michael De Vlieger_, Jan 06 2016 *)
%o (Python)
%o from sympy import isprime
%o a=[]
%o TOP=1000000
%o for p in range(TOP):
%o if isprime(p):
%o q=p
%o while q<TOP:
%o q = q*q+1
%o if isprime(q):
%o a.append(q)
%o print(sorted(set(a)))
%Y Cf. A000040, A266233.
%K nonn
%O 1,1
%A _Alex Ratushnyak_, Dec 25 2015
|