%I #19 Jan 13 2020 09:36:34
%S 5,10,1,11,99,100,2,13,112,3,103,998,1000,4,17,129,9,12,115,1113,6,
%T 1006,97,101,7,24,153,93,102,8,20,135,1248,98,104,1110,14,111,15,116,
%U 994,1001,81,105,16,169,21,114,18,120,995,1003,86,106,19,154,1402,23,121,22,126,1236,94,108,25,136,92,107,26
%N If a(n) uses fewer digits than a(n+1), we compute K = |a(n) - a(n+1)|. The successive such Ks rebuild the sequence itself, with a(1) = 5.
%C 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:
%C 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$.
%C The two rules are:
%C 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);
%C 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).
%C (See the end of the Example section for more.)
%H Lars Blomberg, <a href="/A330599/b330599.txt">Table of n, a(n) for n = 1..10000</a>
%e As 5 uses fewer digits than 10, we compute K1 = |5-10| = 5;
%e as 10 uses more digits than 1, we don't do anything;
%e as 1 uses fewer digits than 11, we compute K2 = |1-11| = 10;
%e as 11 and 99 use the same number of digits, we don't do anything;
%e as 99 uses fewer digits than 100, we compute K3 = |99-100| = 1;
%e as 100 uses more digits than 2, we don't do anything;
%e as 2 uses fewer digits than 13, we compute K4 = |2-13| = 11;
%e as 13 uses fewer digits than 112, we compute K5 = |13-112| = 99; etc.
%e We see that the succession of K1, K2, K3, K4, K5, ... reproduces S.
%e 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.
%e 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.
%K base,nonn
%O 1,1
%A _Eric Angelini_ and _Lars Blomberg_, Dec 19 2019