%I #30 Oct 01 2024 15:22:11
%S 2,3,6,13,21,33,48,58,90,96,99,100,111,118,120,121,133,138,195,204,
%T 279,334,348,366,393,400,465,525,541,565,594,721,736,789,855,859,925,
%U 946,1044,1099,1239,1279,1323,1410,1459,1470,1513,1521,1524,1629,1630,1638
%N Numbers k such that k^3 - k^2 - 1 and k^3 - k^2 + 1 are twin primes.
%C Intersection of A111501 and A162293. - _Ivan Neretin_, Aug 24 2016
%H Harvey P. Dale, <a href="/A111503/b111503.txt">Table of n, a(n) for n = 1..1000</a>
%e 2^3 - 2^2 - 1 = 3, 2^3 - 2^2 + 1 = 5, 3 and 5 are twin primes, so 2 is in the sequence.
%t lst={}; Do[If[PrimeQ[n^3-n^2-1]&&PrimeQ[n^3-n^2+1], AppendTo[lst, n]], {n, 10^3}]; lst (* _Vladimir Joseph Stephan Orlovsky_, Aug 08 2008 *)
%t tpQ[n_]:=Module[{c=n^3-n^2},And@@PrimeQ[{c+1,c-1}]]; Select[Range[ 1700],tpQ] (* _Harvey P. Dale_, Aug 27 2012 *)
%o (Magma) [n: n in [0..100000] |IsPrime(n^3-n^2-1) and IsPrime(n^3-n^2+1)]; // _Vincenzo Librandi_, Nov 13 2010
%o (PARI) isok(n) = isprime(n^3 - n^2 - 1) && isprime(n^3 - n^2 + 1); \\ _Michel Marcus_, Aug 24 2016
%Y Cf. A111501, A162293.
%K nonn
%O 1,1
%A _Pierre CAMI_, Nov 16 2005