

A324673


Starting at n, a(n) is the length of the smallest interval containing all points 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


0



0, 1, 6, 3, 68, 72, 6, 13205, 31, 36, 10, 104, 836, 836, 43, 15, 570, 9518374, 57, 60, 1548481, 21, 203, 80, 87, 15466141, 71, 71, 28, 2436, 118129102, 6815959, 6815959, 6815959, 6815959, 86, 36, 560, 2261901, 2261901, 1091, 103, 103, 103, 6831, 45, 758, 499
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


LINKS

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


EXAMPLE

For n=2, the points visited are 2,1,1,4,0. The smallest interval containing these is [4,2] which has length 6, thus a(2) = 6.


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 max(d['spots'])min(d['spots'])


CROSSREFS

Cf. A228474, A324660A324692. Equals A248953  A248952.
Sequence in context: A088390 A286782 A054380 * A324004 A002610 A100979
Adjacent sequences: A324668 A324671 A324672 * A324674 A324675 A324676


KEYWORD

nonn


AUTHOR

David Nacin, Mar 10 2019


STATUS

approved



