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.

Previous Showing 11-20 of 42 results. Next

A248961 Sums of wrecker ball sequences starting with n.

Original entry on oeis.org

0, 1, -2, 5, -292, -241, 14, -437861, -28, -1, 30, 313, -4472, -4223, -2, 55, 3252, -214246256269, -70, -27, 5260887648, 91, -538, -193, -132, -864538549823, -22, 27, 140, 40053, 53088613819206, 86166834699, 86167898716, 86168962733, 86170026754, 49, 204
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 18 2014

Keywords

Comments

a(n) = A248973(n, A228474(n)) = sum of row n in triangle A248939;
a(A000217(n)) = A000330(n).

Examples

			a(1) = 1+0 = 1;
a(2) = 2+1-1-4+0 = -2;
a(3) = 3+2+0 = 5;
a(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 = -292;
a(5) = 5+4+2-1+3-2-8-15-7-16-6-17-5+8+22+7-9-26-44-25-45-24-46-... = -241;
a(6) = 6+5+3+0 = 14;
a(7) = 7+6+4+1-3+2-4+3-5-14-24-13-1+12-2+13+29+46+28+9-11+10-... = -437861;
a(8) = 8+7+5+2-2+3-3+4-4-13-23-12+0 = -28;
a(9) = 9+8+6+3-1+4-2+5-3-12-22-11+1+14+0 = -1.
		

Crossrefs

Programs

  • Haskell
    import Data.IntSet (singleton, member, insert)
    a248961 n = addup 1 n 0 $ singleton n where
       addup  0 sum  = sum
       addup k x sum s = addup (k + 1) y (sum + x) (insert y s) where
                         y = x + (if (x - j) `member` s then j else -j)
                         j = k * signum x
    (C++) #include
    long A248961(long n) { long c=0, d, S=n; for(std::set A; n; A.insert(n), S += n += A.count(n - (d = n>0 ? c : -c)) ? d : -d) ++c; return S; } // M. F. Hasler, Mar 19 2019
    
  • PARI
    A248961(n,A=[n],c,S=n)={while( n+=sign(n)*if(setsearch(A,n-sign(n)*c+=1), c, -c), A=setunion(A,[n]); S+=n); S} \\ M. F. Hasler, Mar 19 2019
    
  • Python
    def A248961(n):
      A = {n}; c = 0; S = 0
      while n != 0:
        ++c; s = c if n>0 else -c; n += s if n-s in A else -s; A.add(n); S += n
      return S # M. F. Hasler, Mar 19 2019

A248973 Table read by rows: row n contains the partial sums of the wrecker ball sequences starting with n, cf. A248939.

Original entry on oeis.org

0, 1, 1, 2, 3, 2, -2, -2, 3, 5, 5, 4, 7, 8, 6, 8, 5, -4, -20, -28, -45, -52, -70, -76, -69, -48, -42, -52, -79, -124, -150, -196, -221, -268, -292, -292, 5, 9, 11, 10, 13, 11, 3, -12, -19, -35, -41, -58, -63, -55, -33, -26, -35, -61, -105, -130, -175, -199, -245, -268, -267, -241, -241
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 20 2014

Keywords

Comments

A228474(n) + 1 = length of row n;
row n = partial sums of row n in A248939;
T(n,A228474(n)) = A248961(n).

Crossrefs

Cf. A228474 (row lengths - 1), A248961 (right edge).

Programs

  • Haskell
    a248973 n k = a248973_tabf !! n !! k
    a248973_row n = a248973_tabf !! n
    a248973_tabf = map (scanl1 (+)) a248939_tabf

Formula

T(n,0) = n; T(n,k) = T(n,k-1) + A248939(n,k) for k=1..A228474(n).

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)

A324671 Starting at n, a(n) is the distance from zero of the farthest point 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, 4, 3, 47, 46, 6, 6843, 23, 22, 10, 72, 471, 470, 29, 15, 352, 4843985, 39, 38, 891114, 21, 102, 57, 56, 7856204, 45, 44, 28, 1700, 61960674, 3702823, 3702824, 3702825, 3702826, 51, 36, 370, 1213998, 1213997, 596, 62, 61, 60, 3855, 45, 417, 260, 261, 237
Offset: 0

Views

Author

David Nacin, Mar 10 2019

Keywords

Examples

			For n=2, the points visited are 2,1,-1,-4,0.  Of those the one farthest from zero is -4 with a distance of 4, hence a(2) = 4.
		

Crossrefs

Cf. A228474, A324660-A324692. Equals max(A248953, -A248952).

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 max(abs(i) for i in d['spots'])
Previous Showing 11-20 of 42 results. Next