OFFSET
1,1
COMMENTS
The intent of the authors was not to produce the lexicographically earliest sequence S of distinct terms > 0 with this property; instead they used two rules:
Let x be the current last term, y the next term, z the term after that and w a previous term to be matched. The number of digits in x is denoted $x$.
The two rules are:
1) If possible, y is selected so that y - x = w and $y$ > $x$, for example x=5, y=10, w=5 in (5, 10);
2) Otherwise first select y with $y$ <= $x$ and then z so that z - y = w and $z$ > $y$, for example x=10, y=1, z=11, w=10 in (5, 10, 1, 11).
(See the end of the Example section for more.)
LINKS
Lars Blomberg, Table of n, a(n) for n = 1..10000
EXAMPLE
As 5 uses fewer digits than 10, we compute K1 = |5-10| = 5;
as 10 uses more digits than 1, we don't do anything;
as 1 uses fewer digits than 11, we compute K2 = |1-11| = 10;
as 11 and 99 use the same number of digits, we don't do anything;
as 99 uses fewer digits than 100, we compute K3 = |99-100| = 1;
as 100 uses more digits than 2, we don't do anything;
as 2 uses fewer digits than 13, we compute K4 = |2-13| = 11;
as 13 uses fewer digits than 112, we compute K5 = |13-112| = 99; etc.
We see that the succession of K1, K2, K3, K4, K5, ... reproduces S.
a(4) = 11 illustrates the Comments section, as a(4) = 2 could also extend S with no contradiction. But 11, one digit longer than 2, was chosen instead.
a(9) = 112 illustrates the same option, as a(9) = 4 could also extend S with no contradiction. But 112, one digit longer than 13, was preferred.
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Lars Blomberg, Dec 19 2019
STATUS
approved