

A324678


Starting at n, a(n) is the minimum negative position 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 kth 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.


0



0, 0, 0, 0, 0, 0, 0, 3165, 0, 0, 0, 0, 140, 139, 0, 0, 0, 3072845, 0, 0, 383171, 0, 0, 0, 0, 4869724, 0, 0, 0, 217, 31071367, 1854085, 1854084, 1854083, 1854082, 0, 0, 24, 696919, 696918, 26, 1, 0, 0, 1920, 0, 148, 86, 85, 84, 83, 144
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,8


LINKS

Table of n, a(n) for n=0..51.


EXAMPLE

For n=41, the points visited are 41, 40, 38, 35, 31, 26, 20, 13, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10, 9, 11, 10, 12, 11, 35, 60, 34, 61, 33, 62, 32, 1, 33, 0. The only position from which we are forced to revisit a spot is 1 which forces a return to 33. As this is the only position and it is negative, it is the minimum negative position and thus a(41)=1.


PROG

(Python)
#Sequences A324660A324692 generated by manipulating this trip function
#spots  positions in order with possible repetition
#flee  positions from which we move away from zero with possible repetition
#stuck  positions from which we move to a spot already visited with possible repetition
def trip(n):
stucklist = list()
spotsvisited = [n]
leavingspots = list()
turn = 0
forbidden = {n}
while n != 0:
turn += 1
sign = n // abs(n)
st = sign * turn
if n  st not in forbidden:
n = n  st
else:
leavingspots.append(n)
if n + st in forbidden:
stucklist.append(n)
n = n + st
spotsvisited.append(n)
forbidden.add(n)
return {'stuck':stucklist, 'spots':spotsvisited,
'turns':turn, 'flee':leavingspots}
def minorzero(x):
if x:
return min(x)
return 0
#Actual sequence
def a(n):
d=trip(n)
return minorzero([i for i in d['stuck'] if i<0])


CROSSREFS

Cf. A228474, A324660A324692.
Sequence in context: A151750 A031610 A252636 * A068266 A140350 A309024
Adjacent sequences: A324675 A324676 A324677 * A324679 A324680 A324681


KEYWORD

sign


AUTHOR

David Nacin, Mar 10 2019


STATUS

approved



