login
A358054
Starting with 0, smallest integer not yet in the sequence such that no two neighboring digits differ by 1.
1
0, 2, 4, 1, 3, 5, 7, 9, 6, 8, 11, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 37, 38, 39, 40, 41, 42, 44, 46, 47, 48, 49, 50, 51, 52, 53, 55, 57, 58, 59, 60, 61, 62, 63, 64, 66, 68, 69, 70, 71, 72, 73, 74, 75, 77, 79, 90, 80
OFFSET
0,2
COMMENTS
Integers such as 10, 12, 21, 76, 6792, and 10744 (see A082927) will not appear in the sequence as they contain adjacent digits that differ by 1. Some integers may be disallowed only temporarily; for example, if a(n) = 79, and all nonnegative integers < 79 are already in the sequence, then a(n+1) = 90, because a(n+1) must not start with an 8, as it would differ by 1 from the digit "9" in 79. Now, a(n+2) can equal 80.
LINKS
David A. Corneth, PARI program
EXAMPLE
a(0) = 0.
a(1) = 2. Cannot be 1. Smallest integer that can be placed = 2.
a(2) = 4. Cannot be 1 or 3. Smallest integer that can be placed = 4.
a(3) = 1. Cannot be 3 or 5. Smallest integer that can be placed = 1.
...
(Nonnegative integers < 86, disregarding invalid integers, have already appeared.)
a(74) = 86.
a(75) = 88. Cannot be 87, as it contains adjacent digits that differ by 1. Smallest integer that can be placed = 88.
a(76) = 111. Cannot be 89, 90->99 (9 and 8 differ by 1), or 100->110 (1 and 0 are adjacent and differ by 1). Smallest integer that can be placed = 111.
PROG
(PARI) \\ See PARI link \\ David A. Corneth, Oct 31 2022
CROSSREFS
Sequence in context: A198578 A173658 A277618 * A219250 A376128 A361643
KEYWORD
nonn,base,easy
AUTHOR
Gavin Lupo and Eric Angelini, Oct 28 2022
STATUS
approved