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.

A076653 Smallest prime number not occurring earlier and starting with the final digit of the previous term.

This page as a plain text file.
%I A076653 #29 Dec 05 2015 17:25:53
%S A076653 2,23,3,31,11,13,37,7,71,17,73,307,79,97,701,19,907,709,911,101,103,
%T A076653 311,107,719,919,929,937,727,733,313,317,739,941,109,947,743,331,113,
%U A076653 337,751,127,757,761,131,137,769,953,347,773,349,967,787,797,7001,139,971
%N A076653 Smallest prime number not occurring earlier and starting with the final digit of the previous term.
%C A076653 This sequence is infinite but still does not contain all the primes. There is no way for 5 to appear, nor any higher prime starting with 5. - _Alonso del Arte_, Sep 19 2015
%C A076653 Moreover, it is an obvious fact that there is no way for any prime starting with 2 (aside from the first two), 4, 6 or 8 to appear. - _Altug Alkan_, Sep 20 2015
%C A076653 Apart from the first two terms, this sequence is identical to how it would be if it were to start with 5 and 53 instead of 2 and 23. - _Maghraoui Abdelkader_, Sep 22 2015
%C A076653 From _Danny Rorabaugh_, Dec 01 2015: (Start)
%C A076653 We can initiate with a different prime p (see the a-file):
%C A076653     p=3: [a(3), a(4), ...];
%C A076653     p=5: [5, 53, a(3), a(4), ...];
%C A076653     p=7: [7, 71, 11, 13, 3, 31, 17, 73, 37, ...];
%C A076653 etc.
%C A076653 Define p~q to mean that the sequences generated by p and q eventually coincide (with different offset allowed). For example, we can see that 2~3~5, but it appears these are not equivalent to 7. Empirically, there are exactly four equivalence classes of primes:
%C A076653     Starting with 1, or starting with 2/4/5/6/8 and ending with 1
%C A076653   [11, 13, 17, 19, 41, 61, 101, 103, 107, 109, 113, 127, 131, 137, ...];
%C A076653     Starting with 3, or starting with 2/4/5/6/8 and ending with 2/3/5
%C A076653   [2, 3, 5, 23, 31, 37, 43, 53, 83, 223, 233, 263, 283, 293, 307, ...];
%C A076653     Starting with 7, or starting with 2/4/5/6/8 and ending with 7
%C A076653   [7, 47, 67, 71, 73, 79, 227, 257, 277, 457, 467, 487, 547, 557, ...];
%C A076653     Starting with 9, or starting with 2/4/5/6/8 and ending with 9
%C A076653   [29, 59, 89, 97, 229, 239, 269, 409, 419, 439, 449, 479, 499, ...].
%C A076653 (End)
%H A076653 Zak Seidov, <a href="/A076653/b076653.txt">Table of n, a (n) for n = 1..10000</a>
%H A076653 Danny Rorabaugh, <a href="/A076653/a076653.txt">A076653-variants with prime initial values 2<=a(0)<=997</a>
%p A076653 N:= 10^5: # get all terms before the first a(n) > N
%p A076653 Primes:= select(isprime,[seq(i,i=3..N,2)]):
%p A076653 Inits:= map(p -> floor(p/10^ilog10(p)), Primes):
%p A076653 for d in [1,2,3,7,9] do
%p A076653   Id[d]:= select(t -> Inits[t]=d, [$1..nops(Inits)]); p[d]:= 1;w[d]:= nops(Id[d]);
%p A076653 od:
%p A076653 A[1]:= 2:
%p A076653 for n from 2 do
%p A076653   d:= A[n-1] mod 10;
%p A076653   if p[d] > w[d] then break fi;
%p A076653   A[n]:= Primes[Id[d][p[d]]];
%p A076653   p[d]:= p[d]+1;
%p A076653 od:
%p A076653 seq(A[i],i=1..n-1); # _Robert Israel_, Dec 01 2015
%t A076653 prevLastDigPrime[seq_] := Block[{k = 1, lastDigit = Mod[Last@seq, 10]}, While[p = Prime@k; MemberQ[seq, p] || lastDigit != Quotient[p, 10^Floor[Log[10, p]]], k++]; Append[seq, p]]; Nest[prevLastDigPrime, {2}, 55] (* _Robert G. Wilson v_ *)
%t A076653 A076653 = {2}; Do[k = 2; d = Last@IntegerDigits@A076653[[n - 1]]; While[Or[MemberQ[A076653, k], First@IntegerDigits@k != d], k = NextPrime@k]; AppendTo[A076653, k], {n, 2, 60}]; A076653 (* _Michael De Vlieger_, Sep 21 2015 *)
%o A076653 (Sage)
%o A076653 def A076653(lim,p=2):
%o A076653     A = [p]
%o A076653     while len(A)<lim:
%o A076653         for q in Primes():
%o A076653             if (q not in A) and (str(A[-1])[-1]==str(q)[0]):
%o A076653                 A.append(q)
%o A076653                 break
%o A076653     return A
%o A076653 A076653(56) # _Danny Rorabaugh_, Dec 01 2015
%Y A076653 Cf. A076652, A076654, A082238, A089755, A107809, A180022.
%K A076653 base,nonn,look
%O A076653 1,1
%A A076653 _Amarnath Murthy_, Oct 28 2002
%E A076653 More terms from _Robert G. Wilson v_, Nov 17 2005