OFFSET
1,1
COMMENTS
A digit of a number is a local minimum if it is less than (or equal to) its neighboring digit(s). It is a local maximum likewise if it is greater than (or equal to) its neighboring digit(s). For example, 55432123 has three local maxima (the two 5s and the end 3) and one local minimum (the 1).
Because they are nonadjacent, the maxima occur at the end (and the minimum somewhere between), and the sequence of digits must be decreasing up to the minimum, then increasing. This may be taken as part of the definition (which entails nonadjacency of the maxima).
The structure of digits represents a canyon (a deep valley between cliffs). The first digit is equal to the last digit. The first group of digits are in decreasing order. The second group of digits are in increasing order. The digits have a unique smallest digit which represents the bottom of the canyon.
This sequence is finite -- it has 116505 terms. The largest and final term of the sequence is a(116505) = 9876543210123456789.
9752369 is a canyon number because the unique minimum digit is the 2, and the maximum digit is 9 (at the beginning and end).
LINKS
Kellen Myers, Table of n, a(n) for n = 1..116505
EXAMPLE
Illustration of 4104 as a canyon number:
4 . . 4
. . . .
. . . .
. 1 . .
. . 0 .
PROG
(Python)
from itertools import chain, combinations as combs
ups = list(chain.from_iterable(combs(range(10), r) for r in range(2, 11)))
s = set(L[::-1] + R[1:] for L in ups for R in ups if L[0] == R[0])
afull = sorted(int("".join(map(str, t))) for t in s if t[0] == t[-1])
print(afull[:60]) # Michael S. Branicky, Aug 02 2022
CROSSREFS
KEYWORD
fini,nonn,base,full
AUTHOR
Omar E. Pol, Nov 25 2007, Nov 26 2007
EXTENSIONS
Edited by Kellen Myers, Jan 18 2011
STATUS
approved