login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A248939 Table read by rows: wrecker ball sequences starting with n. 9
0, 1, 0, 2, 1, -1, -4, 0, 3, 2, 0, 4, 3, 1, -2, 2, -3, -9, -16, -8, -17, -7, -18, -6, 7, 21, 6, -10, -27, -45, -26, -46, -25, -47, -24, 0, 5, 4, 2, -1, 3, -2, -8, -15, -7, -16, -6, -17, -5, 8, 22, 7, -9, -26, -44, -25, -45, -24, -46, -23, 1, 26, 0, 6, 5, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

COMMENTS

A228474(n) + 1 = length of row n.

LINKS

Reinhard Zumkeller, Rows n = 0..16 of triangle, flattened

Gordon Hamilton, Wrecker Ball Sequences, Video, 2013

Index entries for sequences related to Recamán's sequence

FORMULA

T(n,0) = n;

There are three cases for k > 0:

case T(n,k-1) > 0:

  if T(n,k-1) - k != T(n,m), for all m=0..k-1 then T(n,k) = T(n,k-1) - k, otherwise T(n,k) = T(n,k-1) + k,

case T(n,k-1) < 0:

  if T(n,k-1) + k != T(n,m), for all m=0..k-1 then T(n,k) = T(n,k-1) + k, otherwise T(n,k) = T(n,k-1) - k,

case T(n,k-1) = 0:

  T(n,k) = 0; row ends, i.e., k = A228474(n).

EXAMPLE

0:  0;

1:  1  0;

2:  2  1  -1  -4  0;

3:  3  2  0;

4:  4  3  1  -2  2  -3  -9  -16  -8  -17  -7  -18  -6  7  21  6  -10  -27  -45  -26  -46  -25  -47  -24  0;

5:  5  4  2  -1  3  -2  -8  -15  -7  -16  -6  -17  -5  8  22  7  -9  -26  -44  -25  -45  -24  -46  -23  1  26  0;

6:  6  5  3  0;

7:  7  6  4  1  -3  2  -4  3  -5  -14  -24  -13  -1  12  -2  13 29 . . . . . . . . 1730  3445  1729  3446  1728  3447  1727  3448  1726  3449  1725  0;

8:  8  7  5  2  -2  3  -3  4  -4  -13  -23  -12  0;

9:  9  8  6  3  -1  4  -2  5  -3  -12  -22  -11  1  14  0.

PROG

(Haskell)

import Data.IntSet (singleton, member, insert)

a248939 n k = a248939_tabf !! n !! k

a248939_tabf = map a248939_row [0..]

a248939_row n = n : wBall 1 n (singleton n) where

   wBall _ 0 _ = []

   wBall k x s = y : wBall (k + 1) y (insert y s) where

                     y = x + (if (x - j) `member` s then j else -j)

                     j = k * signum x

(PARI)

row(n)={my(M=Map(), L=List(), k=0); while(n, k++; listput(L, n); mapput(M, n, 1); my(t=if(n>0, -k, +k)); n+=if(mapisdefined(M, n+t), -t, t)); listput(L, 0); Vec(L)}

for(n=0, 6, print(row(n))) \\ Andrew Howroyd, Mar 01 2018

CROSSREFS

Cf. A228474 (row lengths - 1), A248961 (row sums), A248973 (partial sums per row), A248952 (min per row), A248953 (max per row), A001532 (Recamán).

Cf. A248940 (row 7), A248941 (row 17), A248942 (row 20).

Sequence in context: A010247 A087605 A251636 * A106246 A136674 A144383

Adjacent sequences:  A248936 A248937 A248938 * A248940 A248941 A248942

KEYWORD

sign,tabf

AUTHOR

Reinhard Zumkeller, Oct 17 2014

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 17 18:48 EST 2018. Contains 317276 sequences. (Running on oeis4.)