

A324674


Starting at n, a(n) is the number of times we travel to a position already visited 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.


1



0, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, 1, 7, 7, 0, 0, 3, 59171, 0, 0, 10456, 0, 0, 0, 0, 89111, 0, 0, 0, 15, 577058, 43885, 43884, 43885, 43886, 0, 0, 2, 19968, 19967, 8, 1, 0, 1, 49, 0, 8, 4, 4, 3, 3, 10, 2, 0, 0, 0, 26, 26, 26, 36950, 36949, 36950, 36951, 36952
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,8


LINKS

Table of n, a(n) for n=0..63.
David Nacin, A324674
David Nacin, A324674(n)/A228474(n)


EXAMPLE

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. When at 27 is reached, the next step must be length 24. As 3 has already been visited, we must move away from zero regardless of whether the point we land on has been visited before, and we revisit 51 an extra time. Since this is the only time this happens, a(11)=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}
#Actual sequence
def a(n):
d=trip(n)
return len(d['stuck'])


CROSSREFS

Cf. A228474, A324660A324692.
Sequence in context: A015040 A235982 A116296 * A113890 A051327 A272637
Adjacent sequences: A324671 A324672 A324673 * A324675 A324676 A324677


KEYWORD

nonn


AUTHOR

David Nacin, Mar 10 2019


STATUS

approved



