login
A379529
a(0) = 0; for n>0, let MSD = Most Significant Digit and LSD = Least Significant Digit, set MSD(a(n)) = [10 - LSD(a(n-1))] mod 10 and let remaining digits of a(n) be such that a(n) is the least integer not yet present in the sequence. If LSD(a(n-1)) = 0 then the least integer not yet present in the sequence is chosen, whatever its MSD is.
1
0, 1, 9, 10, 2, 8, 20, 3, 7, 30, 4, 6, 40, 5, 50, 11, 90, 12, 80, 13, 70, 14, 60, 15, 51, 91, 92, 81, 93, 71, 94, 61, 95, 52, 82, 83, 72, 84, 62, 85, 53, 73, 74, 63, 75, 54, 64, 65, 55, 56, 41, 96, 42, 86, 43, 76, 44, 66, 45, 57, 31, 97, 32, 87, 33, 77, 34, 67, 35
OFFSET
0,3
COMMENTS
Rearrangement of nonnegative integers.
a(n) = n for n = 0, 1, 67, 99, ...
LINKS
EXAMPLE
a(0) = 0; a(1) = 1 because is the least number not yet present in the sequence; a(2) should start with [(10 - 1) mod 10] = [9 mod 10] = 9 and being 9 not yet present in the sequence then a(2) = 9; a(3) should start with [(10 - 9) mod 10] = [1 mod 10] = 1 but 1 is already present and the least integer we can choose is 10, so a(3) = 10; now LSD(a(3)) is 0 and we can simply choose the least number not yet present that is 2: therefore a(4) = 2; and so on.
MAPLE
P:=proc(q) local a, b, c, n, t, v; v:=[0]; t:=0; for n from 2 to q do a:=10-(v[n-1] mod 10) mod 10;
if a=0 then while numboccur(v, t)>0 do t:=t+1; od; v:=[op(v), t]; else
if numboccur(v, a)=0 then v:=[op(v), a]; else c:=-1; b:=a;
while numboccur(v, b)>0 do c:=c+1; if c=0 then b:=10*a; else b:=a*10^length(c)+c; fi; od;
v:=[op(v), b]; fi; fi; od; op(v); end: P(10^2);
CROSSREFS
Cf. A010879.
Sequence in context: A158286 A126839 A341818 * A034058 A347181 A333774
KEYWORD
nonn,easy,base
AUTHOR
Paolo P. Lava, Dec 24 2024
STATUS
approved