This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A324681 Starting at n, a(n) is the sign of the closest nonzero position to zero visited 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. In the cases of a tie or n=0, we set a(n)=0. 0
 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, -1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, -1, 0, 1, 1, 0, -1, 0, 1, 0, -1, 1, 1, 0, -1, -1, -1, -1, 1, 0, 1, 0, 0, 0, -1, 1, 0, -1, -1, 0, 1, 0, -1, 1, 0, 1, 1, 1, 0, -1, -1, 1, 1, 1, 0, -1, -1, -1, -1, 0, -1, 1, 0, 1, 0 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0 LINKS EXAMPLE For n=14, the points visited are 14, 13, 11, 8, 4, -1, 5, -2, 6, -3, 7, -4, -16, -29, -15, 0. The closest of these to zero is -1, which is negative, thus a(14) = sgn(-1) = -1. PROG (Python) #Sequences A324660-A324692 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 sgn(x):     if x:         return x//abs(x)     return 0 def maxorzero(x):     if x:         return max(x)     return 0 def minorzero(x):     if x:         return min(x)     return 0 #Actual sequence def a(n):     d = trip(n)     neg=maxorzero([i for i in d['spots'] if i < 0])     pos=minorzero([i for i in d['spots'] if i > 0])     return (-sgn(neg+pos) + [2, 0][sgn(neg)])*sgn(n) CROSSREFS Cf. A228474, A324660-A324692. Sequence in context: A093879 A117872 A291291 * A285249 A269027 A089809 Adjacent sequences:  A324678 A324679 A324680 * A324682 A324683 A324684 KEYWORD sign AUTHOR David Nacin, Mar 10 2019 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified October 22 19:53 EDT 2019. Contains 328319 sequences. (Running on oeis4.)