

A324683


Starting at n, a(n) is the number of times we move from a negative position to a spot we have 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, 52, 0, 0, 0, 0, 6, 6, 0, 0, 0, 33300, 0, 0, 4302, 0, 0, 0, 0, 58682, 0, 0, 0, 6, 154594, 18830, 18829, 18829, 18829, 0, 0, 2, 10283, 10282, 3, 1, 0, 0, 29, 0, 5, 3, 3, 3, 3, 5, 2, 0, 0, 0, 9, 9, 9, 21706, 21705, 21705, 21705, 21705, 1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,8


LINKS

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


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 time we revisit a spot is when we move from 1 to 33. As this only occurs for one negative number, 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}
#Actual sequence
def a(n):
d = trip(n)
return sum(1 for i in d['stuck'] if i < 0)


CROSSREFS

Cf. A228474, A324660A324692.
Sequence in context: A281979 A172695 A172786 * A214373 A230299 A308235
Adjacent sequences: A324680 A324681 A324682 * A324684 A324685 A324686


KEYWORD

nonn


AUTHOR

David Nacin, Mar 10 2019


STATUS

approved



