login
Numbers k such that k^2+1, (k+2)^2+1 and (k+6)^2+1 are prime.
2

%I #31 Sep 08 2022 08:46:21

%S 4,14,124,204,464,1144,1314,1564,1964,2454,3134,4174,4364,5584,5874,

%T 6234,7804,8174,8784,9874,9894,10424,12354,12484,12874,14034,14194,

%U 15674,16224,18274,18994,21134,21344,22344,22624,23134,23784,23944,24974,25554,26504,26934,27064,27804,29364

%N Numbers k such that k^2+1, (k+2)^2+1 and (k+6)^2+1 are prime.

%H Chai Wah Wu, <a href="/A302021/b302021.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..200 from Seiichi Manyama)

%p select(k->isprime(k^2+1) and isprime((k+2)^2+1) and isprime((k+6)^2+1),[$1..40000]); # _Muniru A Asiru_, Apr 02 2018

%t Select[Range[1, 30000], PrimeQ[#^2 + 1] && PrimeQ[(# + 2)^2 + 1] && PrimeQ[(# + 6)^2 + 1] &] (* _Vincenzo Librandi_, Apr 02 2018 *)

%o (Python)

%o from python import isprime

%o k, klist, A302021_list = 0, [isprime(i**2+1) for i in range(6)], []

%o while len(A302021_list) < 10000:

%o i = isprime((k+6)**2+1)

%o if klist[0] and klist[2] and i:

%o A302021_list.append(k)

%o k += 1

%o klist = klist[1:] + [i] # _Chai Wah Wu_, Apr 01 2018

%o (Magma) [n: n in [1..30000] | IsPrime(n^2+1) and IsPrime((n+2)^2+1) and IsPrime((n+6)^2+1)]; // _Vincenzo Librandi_, Apr 02 2018

%o (PARI) isok(k) = isprime(k^2+1) && isprime((k+2)^2+1) && isprime((k+6)^2+1); \\ _Altug Alkan_, Apr 02 2018

%Y Cf. A005574, A096012, A302087.

%K nonn

%O 1,1

%A _Seiichi Manyama_, Mar 31 2018