Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #12 Mar 10 2014 12:50:08
%S 23518,146014,486718,564814,3285598,4629406,7151614,11645326,22584814,
%T 29983198,31754206,64319998,355897438,745319086,864614014,1304555614,
%U 2334990526,2903803726,3447511198,3934332718,4194050014,4596374014,5838479998,6866219998
%N Numbers n of the form p^3-p^2-p-1 (for prime p) such that n^3-n^2-n-1 is prime.
%C All numbers are congruent to 4 mod 10, 6 mod 10, or 8 mod 10.
%e 23518 = 29^3-29^2-29-1 (29 is prime) and 23518^3-23518^2-23518-1 = 13007166227989 is prime. Thus, 23518 is a member of this sequence.
%t f[n_] := n^3 - n^2 - n - 1; f[ Select[ Prime@ Range[2,740],PrimeQ@ f@ f@#&]] (* _Robert G. Wilson v_, Mar 07 2014 *)
%o (Python)
%o import sympy
%o from sympy import isprime
%o {print(n**3-n**2-n-1) for n in range(10**4) if isprime(n) and isprime((n**3-n**2-n-1)**3-(n**3-n**2-n-1)**2-(n**3-n**2-n-1)-1)}
%o (PARI)
%o s=[]; forprime(p=2, 40000, n=p^3-p^2-p-1; if(isprime(n^3-n^2-n-1), s=concat(s, n))); s \\ _Colin Barker_, Feb 10 2014
%Y Cf. A162295.
%K nonn
%O 1,1
%A _Derek Orr_, Feb 09 2014