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.
%I A248952 #37 Mar 24 2023 23:11:57 %S A248952 0,0,-4,0,-47,-46,0,-6362,-23,-22,0,-32,-471,-470,-29,0,-218,-4843985, %T A248952 -39,-38,-657367,0,-101,-57,-56,-7609937,-45,-44,0,-736,-56168428, %U A248952 -3113136,-3113135,-3113134,-3113133,-51,0,-190,-1213998,-1213997,-495,-62,-61,-60 %N A248952 Smallest term in wrecker ball sequence starting with n. %C A248952 Starting at n, a(n) is the minimum value reached 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 from zero instead. See A228474 and A248939. - _David Nacin_, Mar 15 2019 %C A248952 It is currently unproved whether 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, but is certainly greater than 32*10^9. - _M. F. Hasler_, Mar 18 2019 %H A248952 M. F. Hasler, <a href="/A248952/b248952.txt">Table of n, a(n) for n = 0..5000</a> (first 1000 terms from Reinhard Zumkeller), Mar 19 2019 %H A248952 Gordon Hamilton, <a href="https://www.youtube.com/watch?v=mQdNaofLqVc">Wrecker Ball Sequences</a>, Video, 2013 %F A248952 a(n) = smallest term in row n of triangle A248939; %F A248952 a(A000217(n)) = 0; a(A014132(n)) < 0. %e A248952 a(0) = min{0} = 0; %e A248952 a(1) = min{1,0} = 0; %e A248952 a(2) = min{2,1,-1,-4,0} = -4; %e A248952 a(3) = min{3,2,0} = 0; %e A248952 a(4) = min{4,3,1,-2,2,-3,-9,-16,-8,-17,-7,-18,-6,7,21,6,-10,-27,...} = -47; %e A248952 a(5) = min{5,4,2,-1,3,-2,-8,-15,-7,-16,-6,-17,-5,8,22,7,-9,-26,...} = -46; %e A248952 a(6) = min{6,5,3,0} = 0; %e A248952 a(7) = min{7,6,4,1,-3,2,-4,3,-5,-14,-24,-13,-1,12,-2,13,29,46,...} = -6362; %e A248952 a(8) = min{8,7,5,2,-2,3,-3,4,-4,-13,-23,-12,0} = -23; %e A248952 a(9) = min{9,8,6,3,-1,4,-2,5,-3,-12,-22,-11,1,14,0} = -22. %o A248952 (Haskell) %o A248952 import Data.IntSet (singleton, member, insert, findMin, findMax) %o A248952 a248952 n = a248952_list !! n %o A248952 (a248952_list, a248953_list) = unzip $ %o A248952 map (\x -> minmax 1 x $ singleton x) [0..] where %o A248952 minmax _ 0 s = (findMin s, findMax s) %o A248952 minmax k x s = minmax (k + 1) y (insert y s) where %o A248952 y = x + (if (x - j) `member` s then j else -j) %o A248952 j = k * signum x %o A248952 (Python) %o A248952 #This and sequences A324660-A324692 generated by manipulating this trip function %o A248952 #spots - positions in order with possible repetition %o A248952 #flee - positions from which we move away from zero with possible repetition %o A248952 #stuck - positions from which we move to a spot already visited with possible repetition %o A248952 def trip(n): %o A248952 stucklist = list() %o A248952 spotsvisited = [n] %o A248952 leavingspots = list() %o A248952 turn = 0 %o A248952 forbidden = {n} %o A248952 while n != 0: %o A248952 turn += 1 %o A248952 sign = n // abs(n) %o A248952 st = sign * turn %o A248952 if n - st not in forbidden: %o A248952 n = n - st %o A248952 else: %o A248952 leavingspots.append(n) %o A248952 if n + st in forbidden: %o A248952 stucklist.append(n) %o A248952 n = n + st %o A248952 spotsvisited.append(n) %o A248952 forbidden.add(n) %o A248952 return {'stuck':stucklist, 'spots':spotsvisited, %o A248952 'turns':turn, 'flee':leavingspots} %o A248952 #Actual sequence %o A248952 def a(n): %o A248952 d = trip(n) %o A248952 return min(d['spots']) %o A248952 # _David Nacin_, Mar 15 2019 %o A248952 (Python) %o A248952 def A248952(n): %o A248952 return min(A248939_row(n)); # _M. F. Hasler_, Mar 18 2019 %o A248952 (C++) #include<map> %o A248952 long A248952(long n) { long c=0, s, m=0; 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 A248952 Cf. A228474 (main entry for wrecker ball sequences). %Y A248952 Cf. A248939, A248953, A000217, A014132. %K A248952 sign %O A248952 0,3 %A A248952 _Reinhard Zumkeller_, Oct 18 2014 %E A248952 Edited by _M. F. Hasler_, Mar 18 2019