This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A324662 #11 Mar 11 2019 20:43:13 %S A324662 0,1,2,2,4,4,3,3,4,4,4,4,5,5,5,5,5,6,6,6,8,6,7,7,7,9,7,7,7,7,3,7,7,7, %T A324662 7,8,8,8,7,7,8,9,9,9,10,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, %U A324662 10,10,10,10,11,11,11,12,12,12,12,12,12,12,12,12 %N A324662 Starting at n, a(n) is the difference of the number of left moves and the number of right moves according to the following rules. On the k-th step (k=1,2,3,...) move a distance of k in the direction of zero. If the number landed on has been landed on before, move a distance of k away from zero instead. %H A324662 David Nacin, <a href="/A324662/a324662.png">a(n)/sqrt{n}</a> %e A324662 For n=2, the points visited are 2,1,-1,-4,0 with the moves from 2 to 1, 1 to -1, and -1 to -4 being to the left, and the move from -4 to 0 being to the right, hence a(2) = 3 - 1 = 2. %o A324662 (Python) %o A324662 #Sequences A324660-A324692 generated by manipulating this trip function %o A324662 #spots - positions in order with possible repetition %o A324662 #flee - positions from which we move away from zero with possible repetition %o A324662 #stuck - positions from which we move to a spot already visited with possible repetition %o A324662 def trip(n): %o A324662 stucklist = list() %o A324662 spotsvisited = [n] %o A324662 leavingspots = list() %o A324662 turn = 0 %o A324662 forbidden = {n} %o A324662 while n != 0: %o A324662 turn += 1 %o A324662 sign = n // abs(n) %o A324662 st = sign * turn %o A324662 if n - st not in forbidden: %o A324662 n = n - st %o A324662 else: %o A324662 leavingspots.append(n) %o A324662 if n + st in forbidden: %o A324662 stucklist.append(n) %o A324662 n = n + st %o A324662 spotsvisited.append(n) %o A324662 forbidden.add(n) %o A324662 return {'stuck':stucklist, 'spots':spotsvisited, %o A324662 'turns':turn, 'flee':leavingspots} %o A324662 def sgn(x): %o A324662 return x//abs(x) %o A324662 #Actual sequence %o A324662 def a(n): %o A324662 d = trip(n) %o A324662 return sum(sgn(d['spots'][i] - d['spots'][i+1]) for i in range(d['turns'])) %Y A324662 Cf. A228474, A324660-A324692. Equals (A324661-A324660). %K A324662 nonn %O A324662 0,3 %A A324662 _David Nacin_, Mar 10 2019