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.

Showing 1-4 of 4 results.

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

Original entry on oeis.org

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

Views

Author

Amarnath Murthy, Oct 28 2002

Keywords

Comments

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
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
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
From Danny Rorabaugh, Dec 01 2015: (Start)
We can initiate with a different prime p (see the a-file):
p=3: [a(3), a(4), ...];
p=5: [5, 53, a(3), a(4), ...];
p=7: [7, 71, 11, 13, 3, 31, 17, 73, 37, ...];
etc.
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:
Starting with 1, or starting with 2/4/5/6/8 and ending with 1
[11, 13, 17, 19, 41, 61, 101, 103, 107, 109, 113, 127, 131, 137, ...];
Starting with 3, or starting with 2/4/5/6/8 and ending with 2/3/5
[2, 3, 5, 23, 31, 37, 43, 53, 83, 223, 233, 263, 283, 293, 307, ...];
Starting with 7, or starting with 2/4/5/6/8 and ending with 7
[7, 47, 67, 71, 73, 79, 227, 257, 277, 457, 467, 487, 547, 557, ...];
Starting with 9, or starting with 2/4/5/6/8 and ending with 9
[29, 59, 89, 97, 229, 239, 269, 409, 419, 439, 449, 479, 499, ...].
(End)

Crossrefs

Programs

  • Maple
    N:= 10^5: # get all terms before the first a(n) > N
    Primes:= select(isprime,[seq(i,i=3..N,2)]):
    Inits:= map(p -> floor(p/10^ilog10(p)), Primes):
    for d in [1,2,3,7,9] do
      Id[d]:= select(t -> Inits[t]=d, [$1..nops(Inits)]); p[d]:= 1;w[d]:= nops(Id[d]);
    od:
    A[1]:= 2:
    for n from 2 do
      d:= A[n-1] mod 10;
      if p[d] > w[d] then break fi;
      A[n]:= Primes[Id[d][p[d]]];
      p[d]:= p[d]+1;
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Dec 01 2015
  • Mathematica
    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 *)
    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 *)
  • Sage
    def A076653(lim,p=2):
        A = [p]
        while len(A)A076653(56) # Danny Rorabaugh, Dec 01 2015

Extensions

More terms from Robert G. Wilson v, Nov 17 2005

A262283 a(1)=2. For n>1, let s denote the digit-string of a(n-1) with the first digit omitted. Then a(n) is the smallest prime not yet present which starts with s.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 31, 17, 71, 19, 97, 73, 37, 79, 907, 701, 101, 103, 307, 709, 911, 113, 131, 311, 1103, 1031, 313, 137, 373, 733, 331, 317, 173, 739, 397, 971, 719, 191, 919, 193, 937, 379, 797, 977, 773, 7307, 3079, 7901, 9011, 1109, 109, 929, 29, 941, 41
Offset: 1

Views

Author

N. J. A. Sloane, Sep 18 2015

Keywords

Comments

If a(n-1) has a single digit then a(n) is simply the smallest missing prime.
Leading zeros in s are ignored.
The sequence is infinite, since there infinitely many primes that start with s (see the comments in A080165).
The data in the b-file suggests that there are infinitely many primes that do not appear. Hoever, at present that is no proof that even one prime (23, say) never appears. - N. J. A. Sloane, Sep 20 2015
Alois P. Heinz points out that a(n) = A262282(n+29) starting at the 103rd term. - N. J. A. Sloane, Sep 19 2015

Examples

			a(1)=2, so s is the empty string, so a(2) is the smallest missing prime, 3. After a(6)=13, s=3, so a(7) is the smallest missing prime that starts with 3, which is 31.
		

Crossrefs

Programs

  • Haskell
    import Data.List (isPrefixOf, delete)
    a262283 n = a262283_list !! (n-1)
    a262283_list = 2 : f "" (map show $ tail a000040_list) where
       f xs pss = (read ys :: Integer) :
                  f (dropWhile (== '0') ys') (delete ys pss)
                  where ys@(_:ys') = head $ filter (isPrefixOf xs) pss
    -- Reinhard Zumkeller, Sep 19 2015

Extensions

More terms from Alois P. Heinz, Sep 18 2015

A262282 a(1)=11. For n>1, let s denote the digit-string of a(n-1) with the first digit omitted. Then a(n) is the smallest prime not yet present which starts with s.

Original entry on oeis.org

11, 13, 3, 2, 5, 7, 17, 71, 19, 97, 73, 31, 101, 103, 37, 79, 907, 701, 107, 709, 911, 113, 131, 311, 1103, 1031, 313, 137, 373, 733, 331, 317, 173, 739, 397, 971, 719, 191, 919, 193, 937, 379, 797, 977, 773, 7307, 307, 727, 271, 7103, 1033, 337, 3701, 7013
Offset: 1

Views

Author

Keywords

Comments

If a(n-1) has a single digit then a(n) is simply the smallest missing prime.
Leading zeros in s are ignored.
The b-file suggests that there are infinitely many primes that do not appear in the sequence. However, there is no proof at present that any particular prime (23, say) never appears.
Alois P. Heinz points out that this sequence and A262283 eventually merge (see the latter entry for details). - N. J. A. Sloane, Sep 19 2015
A variant without the prime number condition: A262356. - Reinhard Zumkeller, Sep 19 2015

Examples

			a(1)=11, so s=1, a(2) is smallest missing prime that starts with 1, so a(2)=13. Then s=3, so a(3)=3. Then s is the empty string, so a(4)=2, and so on.
		

Crossrefs

Suggested by A089755. Cf. A262283.
Cf. A262356.

Programs

  • Haskell
    import Data.List (isPrefixOf, delete)
    a262282 n = a262282_list !! (n-1)
    a262282_list = 11 : f "1" (map show (delete 11 a000040_list)) where
       f xs pss = (read ys :: Integer) :
                  f (dropWhile (== '0') ys') (delete ys pss)
                  where ys@(_:ys') = head $ filter (isPrefixOf xs) pss
    -- Reinhard Zumkeller, Sep 19 2015

Extensions

More terms from Alois P. Heinz, Sep 18 2015

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],", ") )
Showing 1-4 of 4 results.