OFFSET
1,1
COMMENTS
Note that f(f(f(p))) is always composite. - Zak Seidov, Nov 10 2014
LINKS
Zak Seidov, Table of n, a(n) for n = 1..1000
EXAMPLE
3 is prime, 3^2-3-1 = 5 is prime, and (3^2-3-1)^2-(3^2-3-1)-1 = 19 is prime. Thus, 3 is a member of this sequence.
MATHEMATICA
Select[Prime[Range[2000]], AllTrue[Rest[NestList[#^2-#-1&, #, 2]], PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 03 2017 *)
PROG
(Python)
import sympy
from sympy import isprime
def f(x):
..return x**2-x-1
{print(p) for p in range(10**5) if isprime(p) and isprime(f(p)) and isprime(f(f(p)))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Derek Orr, Feb 26 2014
STATUS
approved