login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A248953
Largest term in wrecker ball sequence starting with n.
10
0, 1, 2, 3, 21, 26, 6, 6843, 8, 14, 10, 72, 365, 366, 14, 15, 352, 4674389, 18, 22, 891114, 21, 102, 23, 31, 7856204, 26, 27, 28, 1700, 61960674, 3702823, 3702824, 3702825, 3702826, 35, 36, 370, 1047903, 1047904, 596, 41, 42, 43, 2976, 45, 341, 260, 261, 123
OFFSET
0,3
COMMENTS
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
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
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..5000 (terms up to n = 1000 from Reinhard Zumkeller), Mar 18 2019
Gordon Hamilton, Wrecker Ball Sequences, Video, 2013
FORMULA
a(n) = largest term in row n of triangle A248939.
a(A000217(n)) = A000217(n).
EXAMPLE
a(0) = max {0} = 0;
a(1) = max {1,0} = 1;
a(2) = max {2,1,-1,-4,0} = 2;
a(3) = max {3,2,0} = 3;
a(4) = max {4,3,1,-2,2,-3,-9,-16,-8,-17,-7,-18,-6,7,21,6,-10,-27,...} = 21;
a(5) = max {5,4,2,-1,3,-2,-8,-15,-7,-16,-6,-17,-5,8,22,7,-9,-26,...} = 26;
a(6) = max {6,5,3,0} = 6;
a(7) = max {7,6,4,1,-3,2,-4,3,-5,-14,-24,-13,-1,12,-2,13,29,46,...} = 6843;
a(8) = max {8,7,5,2,-2,3,-3,4,-4,-13,-23,-12,0} = 8;
a(9) = max {9,8,6,3,-1,4,-2,5,-3,-12,-22,-11,1,14,0} = 14.
PROG
(Haskell)
a248953 n = a248953_list !! n
-- See A248952 for definition of a248953_list.
(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 max(d['spots'])
# David Nacin, Mar 15 2019
(C++) #include<map>
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
CROSSREFS
Cf. A248939 (entire orbit of n), A248952 (minimum of the orbit), A000217, A228474 (length of orbits - 1: main entry for wrecker ball sequences).
Sequence in context: A250181 A024765 A282340 * A090122 A328734 A296254
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Oct 18 2014
EXTENSIONS
Edited by M. F. Hasler, Mar 18 2019
STATUS
approved