OFFSET
1,2
COMMENTS
Up to n=150 the only consecutive terms in the sequence are 19,20,21; 50,51; 90,91; 100,101; 106,107; 108,109,110.
Up to n=150 the sequence of first differences is bounded by -57 and 57 (in nonconsecutive terms).
From Robert G. Wilson v, Jul 26 2018: (Start)
It appears that every number appears.
If so the inverse permutation would be: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 21, 37, 22, 27, 23, ..., .
(End)
Yes, every number appears. Every pandigital number must eventually appear, and for each d in [0,9] there are infinitely many pandigital numbers with digit sum == d (mod 10), so every number containing digit d will eventually appear. - Robert Israel, Aug 30 2018
LINKS
EXAMPLE
a(5)=2 since a(4)=11 and 1+1 is congruent to 2 (mod 10).
a(21)=20 since a(20)=19 and 1+9 is congruent to 0 (mod 10).
MAPLE
N:= 1000: # to get all terms before the first term > N
A[1]:= 0:
for d from 0 to 9 do S[d]:= select(t -> member(d, convert(t, base, 10)), {$1..N}) od:
for n from 2 do
dd:= convert(convert(A[n-1], base, 10), `+`) mod 10;
if S[dd] = {} then break fi;
A[n]:= min(S[dd]);
for d from 0 to 9 do S[d]:= S[d] minus {A[n]} od:
od:
seq(A[i], i=1..n-1); # Robert Israel, Aug 30 2018
MATHEMATICA
f[lst_List] := Block[{k = 1, l = Mod[Plus @@ IntegerDigits@lst[[-1]], 10]}, While[MemberQ[lst, k] || Union[MemberQ[{l}, #] & /@ IntegerDigits@k][[-1]] == False, k++]; Append[lst, k]]; Nest[f, {0}, 72] (* Robert G. Wilson v, Jul 26 2018 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, Jul 25 2018
STATUS
approved