Final digit reached by traveling right (with wraparound) through the digits of n. Each move steps right k places, where k is the digit at the beginning of the move. Moves begin at the most significant digit and d moves are made, where d is the number of digits in n.
(history;
published version)
PROG
(Python)
def A358647(n):
s = list(map(int, str(n)))
l, i = len(s), 0
for _ in range(l):
i = (i+s[i])%l
return s[i] # Chai Wah Wu, Nov 30 2022
Discussion
Mon Nov 28
08:29
Michel Marcus: ah yes offset 0
Discussion
Fri Nov 25
02:44
Moosa Nasir: I think it won't hurt to add it
Sat Nov 26
03:12
Michel Marcus: I don not understand why when n<10, you get a(n) = n-1 ?
11:15
Moosa Nasir: Isn't it when n < 10, a(n) = n. The sequence starts at n = 0. Did I make a mistake in the offset section?
Mon Nov 28
07:01
Kevin Ryde: Ah yes set offset 0 if you start at n=0.