cp's OEIS Frontend

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.

A324680 Starting at n, a(n) is the largest distance from zero among all positions from which a spot must be revisited on the next move, or zero if no such positions exist, 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.

This page as a plain text file.
%I A324680 #6 Mar 11 2019 20:45:44
%S A324680 0,0,0,0,0,0,0,3442,0,0,0,27,140,139,0,0,84,3072845,0,0,638385,0,0,0,
%T A324680 0,4869724,0,0,0,464,43807680,2117461,2117462,2117463,2117464,0,0,24,
%U A324680 696919,696918,179,1,0,1,1920,0,148,86,85,84,83,190,63,0,0,0,1107
%N A324680 Starting at n, a(n) is the largest distance from zero among all positions from which a spot must be revisited on the next move, or zero if no such positions exist, 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.
%H A324680 David Nacin, <a href="/A324680/a324680.png">A324680</a>
%H A324680 David Nacin, <a href="/A324680/a324680_1.png">A324680(n)/A228474(n)</a>
%e A324680 For n=11, the points visited are 11, 10, 8, 5, 1, -4, 2, -5, 3, -6, 4, -7, -19, -32, -18, -3, 13, 30, 12, 31, 51, 72, 50, 27, 51, 26, 0.  The only position from which we are forced to revisit a spot is 27, which forces a return to 51. Since this is the only time this happens it is also has the largest distance from zero, thus a(11)=27.
%o A324680 (Python)
%o A324680 #Sequences A324660-A324692 generated by manipulating this trip function
%o A324680 #spots - positions in order with possible repetition
%o A324680 #flee - positions from which we move away from zero with possible repetition
%o A324680 #stuck - positions from which we move to a spot already visited with possible repetition
%o A324680 def trip(n):
%o A324680     stucklist = list()
%o A324680     spotsvisited = [n]
%o A324680     leavingspots = list()
%o A324680     turn = 0
%o A324680     forbidden = {n}
%o A324680     while n != 0:
%o A324680         turn += 1
%o A324680         sign = n // abs(n)
%o A324680         st = sign * turn
%o A324680         if n - st not in forbidden:
%o A324680             n = n - st
%o A324680         else:
%o A324680             leavingspots.append(n)
%o A324680             if n + st in forbidden:
%o A324680                 stucklist.append(n)
%o A324680             n = n + st
%o A324680         spotsvisited.append(n)
%o A324680         forbidden.add(n)
%o A324680     return {'stuck':stucklist, 'spots':spotsvisited,
%o A324680                 'turns':turn, 'flee':leavingspots}
%o A324680 def maxorzero(x):
%o A324680     if x:
%o A324680         return max(x)
%o A324680     return 0
%o A324680 #Actual sequence
%o A324680 def a(n):
%o A324680     d=trip(n)
%o A324680     return maxorzero([abs(i) for i in d['stuck']])
%Y A324680 Cf. A228474, A324660-A324692.
%K A324680 nonn
%O A324680 0,8
%A A324680 _David Nacin_, Mar 10 2019