cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A248953 Largest term in wrecker ball sequence starting with n.

This page as a plain text file.
%I A248953 #24 May 16 2019 01:32:32
%S A248953 0,1,2,3,21,26,6,6843,8,14,10,72,365,366,14,15,352,4674389,18,22,
%T A248953 891114,21,102,23,31,7856204,26,27,28,1700,61960674,3702823,3702824,
%U A248953 3702825,3702826,35,36,370,1047903,1047904,596,41,42,43,2976,45,341,260,261,123
%N A248953 Largest term in wrecker ball sequence starting with n.
%C A248953 Starting at n, a(n) is the maximum reached according to the following rules: Unless 0 has been reached, on the k-th step (k = 1, 2, 3, ...) move a distance of k in the direction of zero. If the result has already occurred before, move a distance of k away from zero instead. See A228474 and A248939. - _David Nacin_, Mar 15 2019
%C A248953 It is currently unproved that all orbits are finite, and therefore unclear whether all a(n) are well defined. In particular, the orbit of n = 11281 is of unknown length > 32*10^9 steps. - _M. F. Hasler_, Mar 18 2019
%H A248953 M. F. Hasler, <a href="/A248953/b248953.txt">Table of n, a(n) for n = 0..5000</a> (terms up to n = 1000 from Reinhard Zumkeller), Mar 18 2019
%H A248953 Gordon Hamilton, <a href="http://www.youtube.com/watch?v=mQdNaofLqVc">Wrecker Ball Sequences</a>, Video, 2013
%F A248953 a(n) = largest term in row n of triangle A248939.
%F A248953 a(A000217(n)) = A000217(n).
%e A248953 a(0) = max {0} = 0;
%e A248953 a(1) = max {1,0} = 1;
%e A248953 a(2) = max {2,1,-1,-4,0} = 2;
%e A248953 a(3) = max {3,2,0} = 3;
%e A248953 a(4) = max {4,3,1,-2,2,-3,-9,-16,-8,-17,-7,-18,-6,7,21,6,-10,-27,...} = 21;
%e A248953 a(5) = max {5,4,2,-1,3,-2,-8,-15,-7,-16,-6,-17,-5,8,22,7,-9,-26,...} = 26;
%e A248953 a(6) = max {6,5,3,0} = 6;
%e A248953 a(7) = max {7,6,4,1,-3,2,-4,3,-5,-14,-24,-13,-1,12,-2,13,29,46,...} = 6843;
%e A248953 a(8) = max {8,7,5,2,-2,3,-3,4,-4,-13,-23,-12,0} = 8;
%e A248953 a(9) = max {9,8,6,3,-1,4,-2,5,-3,-12,-22,-11,1,14,0} = 14.
%o A248953 (Haskell)
%o A248953 a248953 n = a248953_list !! n
%o A248953 -- See A248952 for definition of a248953_list.
%o A248953 (Python)
%o A248953 #This and sequences A324660-A324692 generated by manipulating this trip function
%o A248953 #spots - positions in order with possible repetition
%o A248953 #flee - positions from which we move away from zero with possible repetition
%o A248953 #stuck - positions from which we move to a spot already visited with possible repetition
%o A248953 def trip(n):
%o A248953     stucklist = list()
%o A248953     spotsvisited = [n]
%o A248953     leavingspots = list()
%o A248953     turn = 0
%o A248953     forbidden = {n}
%o A248953     while n != 0:
%o A248953         turn += 1
%o A248953         sign = n // abs(n)
%o A248953         st = sign * turn
%o A248953         if n - st not in forbidden:
%o A248953             n = n - st
%o A248953         else:
%o A248953             leavingspots.append(n)
%o A248953             if n + st in forbidden:
%o A248953                 stucklist.append(n)
%o A248953             n = n + st
%o A248953         spotsvisited.append(n)
%o A248953         forbidden.add(n)
%o A248953     return {'stuck':stucklist, 'spots':spotsvisited,
%o A248953             'turns':turn, 'flee':leavingspots}
%o A248953 #Actual sequence
%o A248953 def a(n):
%o A248953     d = trip(n)
%o A248953     return max(d['spots'])
%o A248953 # _David Nacin_, Mar 15 2019
%o A248953 (C++) #include<map>
%o A248953 long A248953(long n) { long c=0, s, m=n; for(std::map<long, bool> seen; n; n += seen[n-(s=n>0?c:-c)] ? s:-s) { if(n>m) m=n; seen[n]=true; ++c; } return m; } // _M. F. Hasler_, Mar 18 2019
%Y A248953 Cf. A248939 (entire orbit of n), A248952 (minimum of the orbit), A000217, A228474 (length of orbits - 1: main entry for wrecker ball sequences).
%K A248953 nonn
%O A248953 0,3
%A A248953 _Reinhard Zumkeller_, Oct 18 2014
%E A248953 Edited by _M. F. Hasler_, Mar 18 2019