%I #31 Apr 30 2024 06:05:44
%S 34,42,53,61,68,80,82,101,106,115,125,127,138,141,145,154,157,172,175,
%T 177,191,193,204,222,233,258,259,266,269,279,289,306,308,310,316,324,
%U 369,383,397,399,403,418,422,431,442,443,474,480,491,497,500,502,518
%N Numbers n such that prime(n+1) has the same last digit as prime(n).
%H Muniru A Asiru, <a href="/A107730/b107730.txt">Table of n, a(n) for n = 1..10000</a>
%H Fred B. Holt, <a href="https://arxiv.org/abs/1604.02443">On the last digits of consecutive primes</a>, arXiv:1604.02443 [math.NT], 2016.
%H Robert J. Lemke Oliver, Kannan Soundararajan, <a href="https://arxiv.org/abs/1603.03720">Unexpected biases in the distribution of consecutive primes</a>, arXiv:1603.03720 [math.NT], 2016.
%H <a href="/index/Pri#gaps">Index entries for primes, gaps between</a>
%F Numbers n such that A000040(n)==A000040(n+1) mod 10, or A000040(n+1) - A000040(n) = 10*k for some integer k, or n such that A129750(n) = 0. [Corrected and edited by _M. F. Hasler_, Oct 24 2018]
%F A107730 = A001223^(-1)(A008592) = { i > 0 | A001223(i) == 0 (mod 10)} = U_{k>0} {A174349(5k,j); j >= 1}. - _M. F. Hasler_, Oct 24 2018
%F Union of A320703, A320708, A320713, A320718, ... A116493,..., A116496 ... etc. - _R. J. Mathar_, Apr 30 2024
%e a(1) = 34 because prime(34) = 139, prime(35) = 149, both end with the digit 9.
%e a(2) = 42 because prime(42) = 181, prime(43) = 191, both end with the digit 1.
%e a(4) = 61 because prime(61) = 283, prime(62) = 293, both end with the digit 3.
%e a(5) = 68 because prime(68) = 337, prime(69) = 347, both end with the digit 7.
%p isA107730 := proc(n) local ldign, ldign2 ; ldign := convert(ithprime(n),base,10) ; ldign2 := convert(ithprime(n+1),base,10) ; if op(1,ldign) = op(1,ldign2) then true ; else false ; fi ; end: for n from 1 to 600 do if isA107730(n) then printf("%d, ",n) ; fi ; od ; # _R. J. Mathar_, Jun 15 2007
%t Select[Range[200],IntegerDigits[Prime[ # ]][[ -1]]==IntegerDigits[Prime[ #+1]][[ -1]]&] (* _Stefan Steinerberger_, Jun 14 2007 *)
%t Flatten[Position[Partition[Prime[Range[600]],2,1],_?(Mod[#[[1]],10] == Mod[#[[2]],10]&),{1},Heads->False]] (* _Harvey P. Dale_, Aug 20 2015 *)
%o (PARI) isok(n) = (prime(n) % 10) == prime(n+1) % 10; \\ _Michel Marcus_, Feb 16 2017
%o (PARI) is_A107730(n)=!((nextprime(1+n=prime(n))-n)%10) \\ This (...) is twice as fast as prime(n+1)-prime(n), and prime(n) becomes very slow for n > 41538, even with primelimit = 10^7. - _M. F. Hasler_, Oct 24 2018
%o (GAP) P:=List(Filtered([1..4000],IsPrime),n->Reversed(ListOfDigits(n)));;
%o a:=Filtered([1..Length(P)-1],i->P[i+1][1]=P[i][1]); # _Muniru A Asiru_, Oct 31 2018
%Y Cf. A000040, A129750.
%Y Union of rows r == 0 (mod 5) of A174349. Indices of multiples of 10 (A008592) in A001223.
%K base,easy,nonn
%O 1,1
%A _Jonathan Vos Post_, Jun 12 2007
%E More terms from _Stefan Steinerberger_ and _R. J. Mathar_, Jun 14 2007