%I #33 Oct 30 2022 18:19:59
%S 5,23,47,251,1889,7793,43451,243161,726893,759821,2280857,1820111,
%T 10141499,40727657,19725473,136209239,744771077,400414121,1057859471,
%U 489144599,13160911739,766319189,38451670931,119618704427,21549657539,141116164769,140432294381,437339303279
%N First prime starting a chain of exactly n consecutive primes congruent to 5 modulo 6.
%C The term "exactly" means that before the first and after the last primes of chain, the immediate primes are not congruent to 5 modulo 6.
%C a(21)>2^31, a(22)= 766319189. - _Hugo Pfoertner_, Jul 31 2003
%C See A057622 for the variant where "exactly" is replaced by "at least". See A055625 for the variant "congruent to 1 (mod 6)". - _M. F. Hasler_, Sep 03 2016
%H Giovanni Resta, <a href="/A055626/b055626.txt">Table of n, a(n) for n = 1..35</a> (terms < 4*10^14)
%H J. K. Andersen, <a href="http://primerecords.dk/congruent-primes.htm">Consecutive Congruent Primes</a>.
%t pp = Table[{p = Prime[n], Mod[p, 6]}, {n, 10^6}];
%t sp = Split[pp, Mod[#1[[2]], 6] == Mod[#2[[2]], 6]&];
%t a[n_] := SelectFirst[sp, Length[#] == n && MatchQ[#, {{_Integer, 5} ..}]& ][[1, 1]];
%t Table[an = a[n]; Print[n, " ", an]; an, {n, 1, 13}] (* _Jean-François Alcover_, Nov 21 2018 *)
%o See link in A085516.
%o (PARI) okchain(n, p) = {if ((precprime(p-1) % 6) == 5, return (0)); for (i=1, n, if ((p % 6) != 5, return (0)); p = nextprime(p+1);); if ((p % 6) == 5, 0, 1);}
%o a(n) = {p = 5; while (! okchain(n, p), p = nextprime(p+1)); p;} \\ _Michel Marcus_, Dec 17 2013
%Y Cf. A055623, A055624, A055625, A085516.
%K nonn
%O 1,1
%A _Labos Elemer_, Jun 05 2000
%E a(9)-a(13), including correction of a(9)-a(10) from _Reiner Martin_, Jul 18 2001
%E a(14)-a(20) from _Hugo Pfoertner_, Jul 31 2003
%E a(21)-a(25) from _Jens Kruse Andersen_, May 30 2006
%E a(26) and beyond from _Giovanni Resta_, Aug 04 2013
|