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.

A262254 a(1) = 11; for n>1, a(n) is the smallest prime that starts with the least significant digit of the previous term and has not occurred earlier.

Original entry on oeis.org

11, 13, 31, 17, 71, 19, 97, 73, 37, 79, 907, 701, 101, 103, 307, 709, 911, 107, 719, 919, 929, 937, 727, 733, 311, 109, 941, 113, 313, 317, 739, 947, 743, 331, 127, 751, 131, 137, 757, 761, 139, 953, 337, 769, 967, 773, 347, 787, 797, 7001, 149, 971, 151, 157, 7013, 349, 977, 7019, 983
Offset: 1

Views

Author

Maghraoui Abdelkader, Sep 16 2015

Keywords

Comments

This sequence is different from A089755, as this one does not include single-digit primes.
This sequence is different from A089755, for which a(n+1) uses all the digit of a(n) except the most-significant digit of a(n).
In this sequence, a(n+1) uses only the least-significant digit of a(n).

Examples

			a(3) = 31 where the most significant digit of 31 is 3, which is the least significant digit of a(2) = 13.
		

Crossrefs

Programs

  • Mathematica
    f[s_List] := Block[{lsd = Mod[s[[-1]], 10], p = 3}, While[ IntegerDigits[p][[1]] != lsd || MemberQ[s, p], p = NextPrime@ p]; Append[s, p]]; s = {11}; s = Nest[f, s, 70] (* Robert G. Wilson v, Sep 16 2015 *)
  • PARI
    msd(n)=(n\10^(#Str(n)-1)); l1=1;l3=1;l7=1;l9=1; q=1; lsd(n)=n%10;
    t1 = vector(200); i=1;forprime(n=11,10000, if( digits(n)[1]==1,t1[i]=n; i=i+1 ; )) ;
    t3 = vector(130); i=1;forprime(n=31,3900 ,  if( digits(n)[1]==3,t3[i]=n; i=i+1 ; ));
    t7 = vector(130); i=1;forprime(n=71,70000, if( digits(n)[1]==7,t7[i]=n; i=i+1 ; )) ;
    t9 = vector(130); i=1;forprime(n=97,90000, if( digits(n)[1]==9,t9[i]=n; i=i+1 ; )) ;lsd(n)=n%10;
    t = vector(200);
    findnextnumber(m) =
    {if(lsd(m)==1, l1=t1[i1] ; i1=i1+1;return(l1);); if(lsd(m)==3, l3=t3[i3];  i3=i3+1 ; return(l3););
    if(lsd(m)==7, l7=t7[i7] ; i7=i7+1;return(l7);); if(lsd(m)==9, l9=t9[i9];  i9=i9+1;return(l9);); }
    i1=1;  i3=1;  i7=1;  i9=1;  j=1;s=11;   for(n=1,200,   p=findnextnumber(s) ; t[j]=p; s=p;j++);for(i=1,200, print1(t[i],", ") )