A248952 Smallest term in wrecker ball sequence starting with n.
0, 0, -4, 0, -47, -46, 0, -6362, -23, -22, 0, -32, -471, -470, -29, 0, -218, -4843985, -39, -38, -657367, 0, -101, -57, -56, -7609937, -45, -44, 0, -736, -56168428, -3113136, -3113135, -3113134, -3113133, -51, 0, -190, -1213998, -1213997, -495, -62, -61, -60
Offset: 0
Keywords
Examples
a(0) = min{0} = 0; a(1) = min{1,0} = 0; a(2) = min{2,1,-1,-4,0} = -4; a(3) = min{3,2,0} = 0; a(4) = min{4,3,1,-2,2,-3,-9,-16,-8,-17,-7,-18,-6,7,21,6,-10,-27,...} = -47; a(5) = min{5,4,2,-1,3,-2,-8,-15,-7,-16,-6,-17,-5,8,22,7,-9,-26,...} = -46; a(6) = min{6,5,3,0} = 0; a(7) = min{7,6,4,1,-3,2,-4,3,-5,-14,-24,-13,-1,12,-2,13,29,46,...} = -6362; a(8) = min{8,7,5,2,-2,3,-3,4,-4,-13,-23,-12,0} = -23; a(9) = min{9,8,6,3,-1,4,-2,5,-3,-12,-22,-11,1,14,0} = -22.
Links
- M. F. Hasler, Table of n, a(n) for n = 0..5000 (first 1000 terms from Reinhard Zumkeller), Mar 19 2019
- Gordon Hamilton, Wrecker Ball Sequences, Video, 2013
Crossrefs
Programs
-
Haskell
import Data.IntSet (singleton, member, insert, findMin, findMax) a248952 n = a248952_list !! n (a248952_list, a248953_list) = unzip $ map (\x -> minmax 1 x $ singleton x) [0..] where minmax _ 0 s = (findMin s, findMax s) minmax k x s = minmax (k + 1) y (insert y s) where y = x + (if (x - j) `member` s then j else -j) j = k * signum x
-
Python
#This and 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} #Actual sequence def a(n): d = trip(n) return min(d['spots']) # David Nacin, Mar 15 2019
-
Python
def A248952(n): return min(A248939_row(n)); # M. F. Hasler, Mar 18 2019 (C++) #include
Extensions
Edited by M. F. Hasler, Mar 18 2019
Comments