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.

A371403 Least k such that prime(k), prime(k+1), prime(k+2), ..., prime(k+n) all have the same last digit.

This page as a plain text file.
%I A371403 #32 May 21 2025 14:29:25
%S A371403 34,258,2147,11582,62192,274810,1500309,2235294,10919138,24000612,
%T A371403 3074210315,6244442805,6244442805,143338476264,244844614858
%N A371403 Least k such that prime(k), prime(k+1), prime(k+2), ..., prime(k+n) all have the same last digit.
%C A371403 The interest in studying a sequence of n consecutive prime numbers having the same last digit is to look at the behavior of the rarefaction of these numbers when n becomes large.
%C A371403 a(k) > 10^10 for k >= 14. - _David A. Corneth_, Mar 22 2024
%e A371403 a(1) = A107730(1) = 34 because prime(34) = 139, prime(35) = 149, both end with the digit 9, and no two consecutive smaller primes end with the same digit.
%e A371403 a(2) = 258 because prime(258) = 1627, prime(259) = 1637, prime(260) = 1657 with the same last digit 7, and no three consecutive smaller primes have the same last digit.
%e A371403 a(4) = A371390(1).
%p A371403 nn:=15*10^6:
%p A371403 for n from 2 to 7 do :
%p A371403    ii:=0:d:=array(1..n):
%p A371403   for m from 1 to nn while(ii=0)
%p A371403 do:
%p A371403    lst:={}:
%p A371403      for k from 1 to n do:
%p A371403 d[k]:=irem(ithprime(m+k-1),10):
%p A371403         lst:=lst union {d[k]}:
%p A371403      od:
%p A371403       if lst={d[1]}
%p A371403        then
%p A371403        printf(`%d %d \n`,n-1,m):ii:=1:
%p A371403        else
%p A371403       fi:
%p A371403     od:
%p A371403     od:
%t A371403 a[n_] := Module[{v = Mod[Prime[Range[n + 1]], 10], k = 1, p}, p = Prime[n + 1]; While[! SameQ @@ v, p = NextPrime[p]; v = Join[Rest[v], {Mod[p, 10]}]; k++]; k]; Array[a, 6] (* _Amiram Eldar_, Mar 21 2024 *)
%o A371403 (PARI)
%o A371403 upto(n) = {
%o A371403 	n += 30;
%o A371403 	my(res = List(), q = 2, t = 1, ld = 2, nld, streak = 0);
%o A371403 	forprime(p = 3, oo,
%o A371403 		nld = p%10;
%o A371403 		if(nld == ld,
%o A371403 			streak++;
%o A371403 			if(streak > #res,
%o A371403 				listput(res, t-streak+1);
%o A371403 				print1(t-streak+1", ");
%o A371403 			)
%o A371403 		,
%o A371403 			streak = 0
%o A371403 		);
%o A371403 		q = p;
%o A371403 		ld = nld;
%o A371403 		t++;
%o A371403 		if(t > n,
%o A371403 			return(res);
%o A371403 		)
%o A371403 	);
%o A371403 	res
%o A371403 } \\ _David A. Corneth_, Mar 23 2024
%Y A371403 Cf. A000040, A107730, A129750, A371390.
%K A371403 nonn,base,hard,more
%O A371403 1,1
%A A371403 _Michel Lagneau_, Mar 21 2024
%E A371403 a(7)-a(10) from _Amiram Eldar_, Mar 21 2024
%E A371403 a(11)-a(13) from _David A. Corneth_, Mar 22 2024
%E A371403 a(14) from _Michael S. Branicky_, May 15 2025
%E A371403 a(15) from _Michael S. Branicky_, May 21 2025