cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A366310 First of a sequence of exactly n consecutive primes whose squares have the same last digit.

This page as a plain text file.
%I A366310 #20 Dec 27 2024 00:57:45
%S A366310 2,13,43,157,401,2969,7237,30697,57397,68239,576019,967019,225769,
%T A366310 6590069,10942949,21235127,57401779,186564317,154836067,117219967,
%U A366310 2598759227,7470538489,28594410847,59107046659,240456558467,34511350409,193861351357,249423946921,368059259143
%N A366310 First of a sequence of exactly n consecutive primes whose squares have the same last digit.
%C A366310 a(n) > 4.5*10^11 for n >= 30. - _David A. Corneth_, Oct 07 2023
%e A366310 a(3) = 43 because the 3 consecutive primes 43, 47, 53 all have squares ending in 9, while the primes 41 and 59 preceding 43 and following 53 have squares ending in 1.
%p A366310 N:= 16: # for a(1) .. a(N)
%p A366310 V:= Vector(N):
%p A366310 p:= 2: q:= 2: count:= 0: d:= 4: i:= 1:
%p A366310 while count < N do
%p A366310   p:= nextprime(p);
%p A366310   if p^2 mod 10 <> d then
%p A366310     if i <= N and V[i] = 0 then
%p A366310       V[i]:= q; count:= count+1;
%p A366310     fi;
%p A366310     q:= p; i:= 1; d:= p^2 mod 10;
%p A366310   else
%p A366310     i:= i+1;
%p A366310   fi
%p A366310 od:
%p A366310 convert(V,list);
%o A366310 (PARI)
%o A366310 upto(n) = {
%o A366310 	my(res = [], ld = 4, streak = 1);
%o A366310 	forprime(p = 3, n,
%o A366310 		nd = p^2 % 10;
%o A366310 		if(nd == ld,
%o A366310 			streak++
%o A366310 		,
%o A366310 			if(streak > #res,
%o A366310 				res = concat(res, vector(streak - #res, i, oo))
%o A366310 			);
%o A366310 			if(res[streak] == oo,
%o A366310 				c = p;
%o A366310 				for(i = 1, streak,
%o A366310 					c = precprime(c-1);
%o A366310 				);
%o A366310 				res[streak] = c;
%o A366310 			);
%o A366310 			streak = 1;
%o A366310 		);
%o A366310 		ld = nd
%o A366310 	); res
%o A366310 } \\ _David A. Corneth_, Oct 07 2023
%Y A366310 Cf. A054681.
%K A366310 nonn,base
%O A366310 1,1
%A A366310 _Robert Israel_ and the late _J. M. Bergot_, Oct 06 2023
%E A366310 More terms from _David A. Corneth_, Oct 07 2023