%I #21 Aug 31 2018 03:35:59
%S 0,10,1,11,2,12,3,13,4,14,5,15,6,16,7,17,8,18,9,19,20,21,23,25,27,29,
%T 31,24,26,28,30,32,35,38,41,45,39,22,34,37,40,42,36,49,33,46,50,51,56,
%U 61,47,71,48,52,57,62,58,43,67,53,68,44,78,54,59,64,60,63,69,55,70,72,79
%N a(n) is the smallest positive integer not yet in the sequence that contains a digit equal to the sum of the digits of a(n-1) (mod 10); a(1)=0.
%C 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.
%C Up to n=150 the sequence of first differences is bounded by -57 and 57 (in nonconsecutive terms).
%C From _Robert G. Wilson v_, Jul 26 2018: (Start)
%C It appears that every number appears.
%C 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, ..., .
%C (End)
%C 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
%H Robert G. Wilson v, <a href="/A317330/b317330.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e a(5)=2 since a(4)=11 and 1+1 is congruent to 2 (mod 10).
%e a(21)=20 since a(20)=19 and 1+9 is congruent to 0 (mod 10).
%p N:= 1000: # to get all terms before the first term > N
%p A[1]:= 0:
%p for d from 0 to 9 do S[d]:= select(t -> member(d, convert(t,base,10)), {$1..N}) od:
%p for n from 2 do
%p dd:= convert(convert(A[n-1],base,10),`+`) mod 10;
%p if S[dd] = {} then break fi;
%p A[n]:= min(S[dd]);
%p for d from 0 to 9 do S[d]:= S[d] minus {A[n]} od:
%p od:
%p seq(A[i],i=1..n-1); # _Robert Israel_, Aug 30 2018
%t 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 *)
%Y Cf. A107353.
%K nonn,base
%O 1,2
%A _Enrique Navarrete_, Jul 25 2018
|