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-9 of 9 results.

A184992 a(n) is the least positive integer not occurring earlier that shares a digit with a(n-1); a(1)=1.

Original entry on oeis.org

1, 10, 11, 12, 2, 20, 21, 13, 3, 23, 22, 24, 4, 14, 15, 5, 25, 26, 6, 16, 17, 7, 27, 28, 8, 18, 19, 9, 29, 32, 30, 31, 33, 34, 35, 36, 37, 38, 39, 43, 40, 41, 42, 44, 45, 46, 47, 48, 49, 54, 50, 51, 52, 53, 55, 56, 57, 58, 59, 65, 60, 61, 62, 63, 64, 66, 67, 68, 69, 76, 70, 71, 72, 73
Offset: 1

Views

Author

Eric Angelini, Dec 22 2011

Keywords

Comments

A permutation of the positive integers.

Crossrefs

a(n) = A107353(n) for n>=3. - Alois P. Heinz, Dec 22 2011
Cf. A227118 (inverse); A067581.

Programs

  • Haskell
    import Data.List (delete, intersect); import Data.Function (on)
    a184992 n = a184992_list !! (n-1)
    a184992_list = 1 : f 1 [2..] where
       f u vs = v : f v (delete v vs)
         where v : _ = filter (not . null . (intersect `on` show) u) vs
    -- Reinhard Zumkeller, Jul 01 2013
    
  • Mathematica
    FromDigits /@ Nest[Function[a, Append[a, Block[{k = 2, d}, While[Nand[FreeQ[a, #], IntersectingQ[a[[-1]], #]] &@ Set[d, IntegerDigits@ k], k++]; d]]], {{1}}, 73] (* Michael De Vlieger, Mar 17 2018 *)
  • PARI
    A184992(n,show=0)={my(a=1,u=2^1);for(k=2,n,show && print1(a",");a=Set(Vec(Str(a))); for(j=2,9e9,bittest(u,j) && next;setintersect(Set(Vec(Str(j))),a) || next; u+=2^a=j; break));a}  \\ M. F. Hasler, Dec 22 2011
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an, aset, mink = 1, {1}, 1
        while True:
            yield an
            digset = set(str(an))
            an = next(k for k in count(mink) if k not in aset and set(str(k))&digset)
            aset.add(an)
            while mink in aset: mink += 1
    print(list(islice(agen(), 74))) # Michael S. Branicky, Oct 03 2024

A262323 Lexicographically earliest sequence of distinct terms such that the decimal representations of two consecutive terms overlap.

Original entry on oeis.org

1, 10, 11, 12, 2, 20, 22, 21, 13, 3, 23, 30, 33, 31, 14, 4, 24, 32, 25, 5, 15, 41, 16, 6, 26, 42, 27, 7, 17, 51, 18, 8, 28, 52, 29, 9, 19, 61, 36, 43, 34, 40, 44, 45, 50, 35, 53, 37, 63, 38, 73, 39, 83, 48, 54, 46, 60, 56, 55, 57, 65, 58, 75, 47, 64, 49, 74
Offset: 1

Views

Author

Paul Tek, Sep 19 2015

Keywords

Comments

Two terms are said to overlap:
- if the decimal representation of one term is contained in the decimal representation of the other term (for example, 12 and 2 overlap),
- or if, for some k>0, the first k decimal digits (without leading zero) of one term correspond to the k last decimal digits of the other term (for example, 1017 and 1101 overlap).
This sequence is a permutation of the positive integers, with inverse A262255.
The first overlap involving 1 digit occurs between a(1)=1 and a(2)=10.
The first overlap involving 2 digits occurs between a(108)=100 and a(109)=110.
The first overlap involving 3 digits occurs between a(1039)=1017 and a(1040)=1101.
The first overlap involving 4 digits occurs between a(10584)=10212 and a(10585)=11021.

Examples

			The first terms of the sequence are:
+----+---------+
| n  | a(n)    |
+----+---------+
|  1 |  1      |
|  2 |  10     |
|  3 | 11      |
|  4 |  12     |
|  5 |   2     |
|  6 |   20    |
|  7 |  22     |
|  8 |   21    |
|  9 |    13   |
| 10 |     3   |
| 11 |    23   |
| 12 |     30  |
| 13 |    33   |
| 14 |     31  |
| 15 |      14 |
| 16 |       4 |
| 17 |      24 |
| 18 |     32  |
| 19 |      25 |
| 20 |       5 |
+----+---------+
		

Crossrefs

Cf. A262367 (fixed points), A262411 (ternary version), A262460 (hexadecimal version).

Programs

  • Haskell
    import Data.List (inits, tails, intersect, delete)
    a262323 n = a262323_list !! (n-1)
    a262323_list = 1 : f "1" (map show [2..]) where
       f xs zss = g zss where
         g (ys:yss) | null (intersect its $ tail $ inits ys) &&
                      null (intersect tis $ init $ tails ys) = g yss
                    | otherwise = (read ys :: Int) : f ys (delete ys zss)
         its = init $ tails xs; tis = tail $ inits xs
    -- Reinhard Zumkeller, Sep 21 2015
    
  • Perl
    See Links section.
    
  • Python
    def overlaps(a, b):
      s, t = sorted([str(a), str(b)], key = lambda x: len(x))
      if any(t.startswith(s[i:]) for i in range(len(s))): return True
      return any(t.endswith(s[:i]) for i in range(1, len(s)+1))
    def aupto(nn):
      alst, aset = [1], {1}
      for n in range(2, nn+1):
        an = 1
        while True:
          while an in aset: an += 1
          if overlaps(an, alst[-1]): alst.append(an); aset.add(an); break
          an += 1
      return alst
    print(aupto(67)) # Michael S. Branicky, Jan 10 2021

A162501 Lexicographically earliest permutation of the natural numbers such that in decimal representation the initial digit for each term is equal to the last nonzero digit of its predecessor; a(1)=1.

Original entry on oeis.org

1, 10, 11, 12, 2, 20, 21, 13, 3, 30, 31, 14, 4, 40, 41, 15, 5, 50, 51, 16, 6, 60, 61, 17, 7, 70, 71, 18, 8, 80, 81, 19, 9, 90, 91, 100, 101, 102, 22, 23, 32, 24, 42, 25, 52, 26, 62, 27, 72, 28, 82, 29, 92, 200, 201, 103, 33, 34, 43, 35, 53, 36, 63, 37, 73, 38, 83, 39, 93, 300, 301
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2009

Keywords

Comments

A000030(a(n+1)) = A065881(a(n));
inverse of A162502: a(A162502(n)) = A162502(a(n)) = n;
a(a(n)) = A162503(n).

Crossrefs

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

A076652 Smallest composite number not divisible by 10, not occurring earlier and starting with the end of the previous term.

Original entry on oeis.org

4, 42, 21, 12, 22, 24, 44, 45, 51, 14, 46, 6, 62, 25, 52, 26, 63, 32, 27, 72, 28, 8, 81, 15, 54, 48, 82, 201, 16, 64, 49, 9, 91, 18, 84, 402, 202, 203, 33, 34, 403, 35, 55, 56, 65, 57, 74, 404, 405, 58, 85, 501, 102, 204, 406, 66, 68, 86, 69, 92, 205, 502, 206, 602, 207, 75
Offset: 1

Views

Author

Amarnath Murthy, Oct 28 2002

Keywords

Crossrefs

Extensions

More terms from Matthew Ohlsen (mjo178(AT)psu.edu), Feb 26 2006
More terms from Max Alekseyev, Sep 14 2009

A139079 Smallest number not yet in the sequence that contains the last digit of the previous term, with a(1) = 1.

Original entry on oeis.org

1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 101, 11, 12, 2, 21, 13, 3, 23, 31, 14, 4, 24, 34, 41, 15, 5, 25, 35, 45, 51, 16, 6, 26, 36, 46, 56, 61, 17, 7, 27, 37, 47, 57, 67, 71, 18, 8, 28, 38, 48, 58, 68, 78, 81, 19, 9, 29, 39, 49, 59, 69, 79, 89, 91, 102, 22, 32, 42, 52, 62, 72
Offset: 1

Views

Author

Keywords

Comments

This is a permutation of the positive integers.

Crossrefs

Programs

  • Maple
    a := [1] ; for n from 2 to 100 do ldig := op(-1,a) mod 10 ; for c from 1 do if c in a then ; else dgs := convert(c,base,10) ; if ldig in dgs then a := [op(a),c] ; break; fi; fi; od: od: print(a) ; # R. J. Mathar
  • Mathematica
    s={1};Do[k=1;Until[ContainsAny[IntegerDigits[k],Take[IntegerDigits[s[[-1]]],-1]]&&!MemberQ[s,k],k++];AppendTo[s,k],{m,71}];s (* James C. McMahon, Jun 28 2025 *)

A309540 a(n) is the smallest positive number not yet in the sequence that contains exactly one even digit and exactly one odd digit from a(n-1), and no digit in a(n) is repeated.

Original entry on oeis.org

10, 102, 12, 21, 120, 103, 30, 130, 104, 14, 41, 124, 123, 23, 32, 132, 125, 25, 52, 152, 126, 16, 61, 106, 105, 50, 150, 107, 70, 170, 108, 18, 81, 128, 127, 27, 72, 172, 129, 29, 92, 192, 142, 134, 34, 43, 143, 140, 109, 90, 190, 160, 136, 36, 63, 163
Offset: 1

Views

Author

Enrique Navarrete, Aug 06 2019

Keywords

Examples

			a(2)=102: a(2) is not 100 (since zero would be repeated), nor 101 (since 1 would be repeated).
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local L;
      L:= convert(n,base,10);
      nops(L) = nops(convert(L,set)) and convert(L mod 2,set) = {0,1};
    end proc:
    Cands:= select(filter, [$11 .. 1000]): nC:= nops(Cands):
    R:= 10: r:= 10: r0, r1:= selectremove(type, convert(convert(r,base,10),set),even):
    for count from 1 do
      found:= false;
      for i from 1 to nC+1-count do
        x:= Cands[i];
        Lx:= convert(convert(x,base,10),set);
        if nops(Lx intersect r0) = 1 and nops(Lx intersect r1) = 1 then
          found:= true;
          R:= R, x;
          r:= x;
          Cands:= subsop(i=NULL, Cands);
          r0, r1:= selectremove(type, convert(convert(r,base,10),set),even);
          break
        fi
      od;
      if not found then break fi;
    od:
    R; # Robert Israel, Jan 09 2025

Extensions

Edited by Robert Israel, Jan 10 2025

A374530 Lexicographically earliest permutation of the nonnegative terms such that the absolute difference between the rightmost digit of a(n) and the leftmost digit of a(n+1) is the smallest possible one.

Original entry on oeis.org

0, 1, 10, 11, 12, 2, 20, 13, 3, 30, 14, 4, 40, 15, 5, 50, 16, 6, 60, 17, 7, 70, 18, 8, 80, 19, 9, 90, 100, 101, 102, 21, 103, 31, 104, 41, 105, 51, 106, 61, 107, 71, 108, 81, 109, 91, 110, 111, 112, 22, 23, 32, 24, 42, 25, 52, 26, 62, 27, 72, 28, 82, 29, 92, 200, 113, 33, 34, 43, 35, 53, 36, 63, 37, 73
Offset: 1

Views

Author

Eric Angelini, Jul 10 2024

Keywords

Comments

The mentioned absolute differences are always < 2.

Examples

			The digits touching the 1st comma (0 and 1) have an absolute difference of 1;
The digits touching the 2nd comma (1 and 1) have an absolute difference of 0;
The digits touching the 3rd comma (0 and 1) have an absolute difference of 1;
The digits touching the 4th comma (1 and 1) have an absolute difference of 0;
The digits touching the 5th comma (2 and 2) have an absolute difference of 0;
The digits touching the 6th comma (2 and 2) have an absolute difference of 0;
The digits touching the 7th comma (0 and 1) have an absolute difference of 1;
The digits touching the 8th comma (3 and 3) have an absolute difference of 0;
The digits touching the 9th comma (3 and 3) have an absolute difference of 0; etc.
		

Crossrefs

Programs

  • Python
    from itertools import count
    a = [0]
    while len(a) < 30: a.append(next(k for k in count() if k not in a and ((r:=a[-1]%10)==(l:=int(str(k)[0])) or ((r,l)==(0,1)))))
    print(a) # Dominic McCarty, Mar 24 2025

A098752 a(1) = 1 and a(n+1) is the least number > a(n) that begins with the last digit of a(n) and doesn't end with 0.

Original entry on oeis.org

1, 11, 12, 21, 101, 102, 201, 1001, 1002, 2001, 10001, 10002, 20001, 100001, 100002, 200001, 1000001, 1000002, 2000001, 10000001, 10000002, 20000001, 100000001, 100000002, 200000001, 1000000001, 1000000002, 2000000001, 10000000001
Offset: 1

Views

Author

Eric Angelini, Oct 01 2004

Keywords

Comments

a(n) must be chosen with nonzero rightmost digit.

Crossrefs

Cf. A076654.
Cf. A101233.

Formula

For n == 0 (mod 3), a(n) = 10^(n/3) + 2; for n == 1 (mod 3), n>1, a(n) = 2*10^((n-1)/3) + 1; for n == 2 (mod 3), a(n) = 10^((n+1)/3) + 1. - Sam Alexander, Jan 04 2005
From Chai Wah Wu, Jun 02 2016: (Start)
a(n) = 11*a(n-3) - 10*a(n-6) for n > 7.
G.f.: x*(1 + x + 2*x^2)*(1 + 10*x - 10*x^3 - 10*x^4)/((1 - x)*(1 - 10*x^3)*(1 + x + x^2)). (End)
a(n) = (1-sign((n-1) mod 3))*10^floor(n/3)+10^floor((n+1)/3)-sign(n mod 3)+2, for n > 1. - Wesley Ivan Hurt, Mar 06 2022

Extensions

More terms from Sam Alexander, Jan 04 2005
More terms from David Wasserman, Feb 26 2008
Showing 1-9 of 9 results.