login
a(n) is the smallest prime p such that p and the next n-1 primes are all == 5 (mod 12).
8

%I #15 Apr 03 2023 10:36:10

%S 5,509,4397,42509,647417,647417,1248869,13175609,234946997,1039154933,

%T 7114719473,32021552837,32021552837,1237381737257,2904797643617,

%U 2904797643617,2904797643617

%N a(n) is the smallest prime p such that p and the next n-1 primes are all == 5 (mod 12).

%C Dickson's conjecture implies that a(n) exists for all n.

%C a(18) > 4*10^14. - _Giovanni Resta_, Aug 04 2013

%H The Prime Glossary, <a href="https://t5k.org/glossary/page.php?sort=DicksonsConjecture">Dickson's conjecture</a>

%t For[i=n=1, True, Null, For[j=0, j<n&&Mod[Prime[i+j], 12]==5, j++, Null]; If[j==n, Print[Prime[i]]; n++, i++ ]]

%t Module[{nn=129*10^5,pr5},pr5=Table[If[Mod[Prime[n],12]==5,1,0],{n,nn}];Prime[ #]&/@Flatten[Table[SequencePosition[pr5,PadRight[{},k,1],1],{k,9}],1][[All,1]]] (* The program generates the first 9 terms of the sequence. *) (* _Harvey P. Dale_, Feb 02 2022 *)

%o (PARI) {i=n=1; while(1,j=0; while(j<n&&prime(i+j)%12==5,j++); if(j==n,print(prime(i)); n++,i++))}

%Y Cf. A068227, A068228, A068229, A040117, A068231, A068232, A068233, A068235.

%K nice,nonn

%O 1,1

%A Ferenc Adorjan (fadorjan(AT)freemail.hu), Feb 22 2002

%E Edited by _Dean Hickerson_, Mar 06 2002

%E More terms from _Giovanni Resta_, Feb 18 2006