A317330 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.
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, 31, 24, 26, 28, 30, 32, 35, 38, 41, 45, 39, 22, 34, 37, 40, 42, 36, 49, 33, 46, 50, 51, 56, 61, 47, 71, 48, 52, 57, 62, 58, 43, 67, 53, 68, 44, 78, 54, 59, 64, 60, 63, 69, 55, 70, 72, 79
Offset: 1
Examples
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).
Links
Crossrefs
Cf. A107353.
Programs
-
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 *)
Comments