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.

A374504 Lexicographically earliest sequence of distinct nonnegative terms such that the absolute difference between the rightmost digit of a(n) and the leftmost digit of a(n+1) is the largest possible one.

Original entry on oeis.org

0, 9, 1, 90, 91, 92, 93, 94, 95, 10, 96, 11, 97, 12, 98, 13, 99, 14, 900, 901, 902, 903, 904, 905, 15, 16, 17, 18, 19, 100, 906, 101, 907, 102, 908, 103, 909, 104, 910, 911, 912, 913, 914, 915, 105, 106, 107, 108, 109, 110, 916, 111, 917, 112, 918, 113, 919, 114, 920, 921, 922, 923, 924, 925, 115, 116, 117, 118, 119
Offset: 1

Views

Author

Eric Angelini, Jul 09 2024

Keywords

Comments

Only numbers starting with 1 or 9 are in the sequence, except for a(1).
The first 9 absolute differences are 9,8,8,9,8,7,6,5,4. The next 20 absolute differences form a pattern that repeats itself forever: 9,5,8,6,7,7,6,8,5,9,8,7,6,5,4,4,5,6,7,8.

Examples

			The digits touching the 1st comma (0 and 9) have an absolute difference of 9;
The digits touching the 2nd comma (9 and 1) have an absolute difference of 8;
The digits touching the 3rd comma (1 and 9) have an absolute difference of 8;
The digits touching the 4th comma (0 and 9) have an absolute difference of 9;
The digits touching the 5th comma (1 and 9) have an absolute difference of 8;
The digits touching the 6th comma (2 and 9) have an absolute difference of 7;
The digits touching the 7th comma (3 and 9) have an absolute difference of 6;
The digits touching the 8th comma (4 and 9) have an absolute difference of 5;
The digits touching the 9th comma (5 and 1) have an absolute difference of 4; from now on, the absolute differences enter into a loop.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    def gen(d): # generator of terms that start with d
        pow10 = 1
        while True:
            for i in range(d*pow10, (d+1)*pow10):
                yield i
            pow10 *= 10
    def agen(): # generator of terms
        an, g1, g9 = 0, gen(1), gen(9)
        next1, next9 = next(g1), next(g9)
        while True:
            yield an
            rightmost = an%10
            if rightmost > 5 or (rightmost == 5 and next1 < next9):
                an, next1 = next1, next(g1)
            else:
                an, next9 = next9, next(g9)
    print(list(islice(agen(), 70))) # Michael S. Branicky, Jul 13 2024