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.

Showing 1-10 of 32 results. Next

A324660 Starting at n, a(n) is the total number of moves made to the right 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.

Original entry on oeis.org

0, 0, 1, 0, 10, 11, 0, 861, 4, 5, 0, 11, 59, 60, 5, 0, 57, 390898, 7, 8, 66444, 0, 22, 11, 12, 610392, 8, 9, 0, 211, 4434560, 266001, 266000, 266001, 266002, 9, 0, 43, 106674, 106673, 120, 12, 11, 12, 495, 0, 67, 50, 51, 36, 37, 100, 25, 12, 13, 0, 317, 316
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0 with the move from -4 to 0 being the only one to the right, hence a(2)=1.
		

Crossrefs

Programs

  • Python
    #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 sum(1 for i in range(d['turns']) if d['spots'][i+1] > d['spots'][i])

A248952 Smallest term in wrecker ball sequence starting with n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 18 2014

Keywords

Comments

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
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

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.
		

Crossrefs

Cf. A228474 (main entry for wrecker ball sequences).

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
    long A248952(long n) { long c=0, s, m=0; for(std::map seen; n; n += seen[n-(s=n>0?c:-c)] ? s:-s) { if(nM. F. Hasler, Mar 18 2019

Formula

a(n) = smallest term in row n of triangle A248939;
a(A000217(n)) = 0; a(A014132(n)) < 0.

Extensions

Edited by M. F. Hasler, Mar 18 2019

A248953 Largest term in wrecker ball sequence starting with n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 18 2014

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A248939 (entire orbit of n), A248952 (minimum of the orbit), A000217, A228474 (length of orbits - 1: main entry for wrecker ball sequences).

Programs

  • 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
    long A248953(long n) { long c=0, s, m=n; for(std::map 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

Formula

a(n) = largest term in row n of triangle A248939.
a(A000217(n)) = A000217(n).

Extensions

Edited by M. F. Hasler, Mar 18 2019

A324665 Starting at n, a(n) is the total number of negative positions visited 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.

Original entry on oeis.org

0, 0, 2, 0, 17, 17, 0, 939, 6, 6, 0, 8, 73, 73, 7, 0, 48, 445544, 10, 10, 57947, 0, 30, 16, 16, 782680, 11, 11, 0, 184, 2650008, 232081, 232079, 232079, 232079, 12, 0, 35, 109811, 109809, 123, 17, 15, 15, 577, 0, 82, 62, 62, 45, 45, 104, 32, 16, 16, 0, 281, 279
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0.  As exactly two of these are negative, we have a(2)=2.
		

Crossrefs

Programs

  • Python
    #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 sum(1 for i in d['spots'] if i < 0)

A324680 Starting at n, a(n) is the largest distance from zero among all positions from which a spot must be revisited on the next move, or zero if no such positions exist, 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.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 3442, 0, 0, 0, 27, 140, 139, 0, 0, 84, 3072845, 0, 0, 638385, 0, 0, 0, 0, 4869724, 0, 0, 0, 464, 43807680, 2117461, 2117462, 2117463, 2117464, 0, 0, 24, 696919, 696918, 179, 1, 0, 1, 1920, 0, 148, 86, 85, 84, 83, 190, 63, 0, 0, 0, 1107
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=11, the points visited are 11, 10, 8, 5, 1, -4, 2, -5, 3, -6, 4, -7, -19, -32, -18, -3, 13, 30, 12, 31, 51, 72, 50, 27, 51, 26, 0.  The only position from which we are forced to revisit a spot is 27, which forces a return to 51. Since this is the only time this happens it is also has the largest distance from zero, thus a(11)=27.
		

Crossrefs

Programs

  • Python
    #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}
    def maxorzero(x):
        if x:
            return max(x)
        return 0
    #Actual sequence
    def a(n):
        d=trip(n)
        return maxorzero([abs(i) for i in d['stuck']])

A324661 Starting at n, a(n) is the total number of moves made to the left 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.

Original entry on oeis.org

0, 1, 3, 2, 14, 15, 3, 864, 8, 9, 4, 15, 64, 65, 10, 5, 62, 390904, 13, 14, 66452, 6, 29, 18, 19, 610401, 15, 16, 7, 218, 4434563, 266008, 266007, 266008, 266009, 17, 8, 51, 106681, 106680, 128, 21, 20, 21, 505, 9, 77, 60, 61, 46, 47, 110, 35, 22, 23, 10, 327
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0 with the moves from 2 to 1, 1 to -1, and -1 to -4 being the only ones to the left, hence a(2)=3.
		

Crossrefs

Programs

  • Python
    #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 sum(1 for i in range(d['turns']) if d['spots'][i+1] < d['spots'][i])

A324662 Starting at n, a(n) is the difference of the number of left moves and the number of right moves 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.

Original entry on oeis.org

0, 1, 2, 2, 4, 4, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 8, 6, 7, 7, 7, 9, 7, 7, 7, 7, 3, 7, 7, 7, 7, 8, 8, 8, 7, 7, 8, 9, 9, 9, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0 with the moves from 2 to 1, 1 to -1, and -1 to -4 being to the left, and the move from -4 to 0 being to the right, hence a(2) = 3 - 1 = 2.
		

Crossrefs

Programs

  • Python
    #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}
    def sgn(x):
        return x//abs(x)
    #Actual sequence
    def a(n):
        d = trip(n)
        return sum(sgn(d['spots'][i] - d['spots'][i+1]) for i in range(d['turns']))

A324663 Starting at n, a(n) is the number of moves made away from zero 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.

Original entry on oeis.org

0, 0, 1, 0, 9, 10, 0, 740, 2, 3, 0, 7, 48, 49, 2, 0, 39, 348242, 3, 4, 59273, 0, 12, 5, 6, 523146, 3, 4, 0, 177, 3533234, 241226, 241225, 241226, 241227, 3, 0, 28, 101615, 101614, 93, 5, 4, 5, 420, 0, 49, 34, 35, 23, 24, 84, 13, 4, 5, 0, 262, 261, 260, 221950
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0 with all moves being towards zero from the current position except for the move from -1 to -4, hence a(2) = 1.
		

Crossrefs

Programs

  • Python
    #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 len(d['flee'])

A324664 Starting at n, a(n) is the smallest distance from zero for which the next move is a step away from zero, or zero if no such move is ever made, 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.

Original entry on oeis.org

0, 0, 1, 0, 3, 1, 0, 5, 4, 1, 0, 7, 6, 1, 4, 0, 7, 8, 7, 1, 2, 0, 5, 4, 1, 2, 7, 1, 0, 13, 2, 1, 10, 1, 1, 7, 0, 5, 1, 3, 2, 1, 10, 1, 2, 0, 17, 16, 1, 14, 1, 2, 11, 10, 1, 0, 1, 1, 17, 1, 15, 1, 1, 1, 11, 10, 0, 4, 1, 2, 1, 1, 1, 15, 1, 13, 1, 1, 0, 2, 1, 1
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0 with all moves being towards zero from the current position except for the move from -1 to -4.  Thus the closest distance to zero from which a move is made away from zero is a(2) = 1.
		

Crossrefs

Programs

  • Python
    #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}
    def minorzero(x):
        if x:
            return min(x)
        return 0
    #Actual sequence
    def a(n):
        d = trip(n)
        return minorzero([abs(i) for i in d['flee']])

A324666 Starting at n, a(n) is the total number of positive positions visited 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.

Original entry on oeis.org

0, 1, 2, 2, 7, 9, 3, 786, 6, 8, 4, 18, 50, 52, 8, 5, 71, 336258, 10, 12, 74949, 6, 21, 13, 15, 438113, 12, 14, 7, 245, 6219115, 299928, 299928, 299930, 299932, 14, 8, 59, 103544, 103544, 125, 16, 16, 18, 423, 9, 62, 48, 50, 37, 39, 106, 28, 18, 20, 10, 363
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0.  As exactly two of these are positive, we have a(2)=2.
		

Crossrefs

Programs

  • Python
    #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 sum(1 for i in d['spots'] if i > 0)
Showing 1-10 of 32 results. Next