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-4 of 4 results.

A276163 a(n) is the maximum first-player score difference of a "Coins in a Row" game over all permutations of coins 1..n with both players using a minimax strategy.

Original entry on oeis.org

1, 1, 2, 4, 5, 9, 6, 16, 9, 25, 10, 36, 13, 49, 14, 64
Offset: 1

Views

Author

Peter Kagey, Aug 22 2016

Keywords

Comments

a(2*n) = n^2 via [1, n+1, 2, n+2, ..., n, 2*n]

Examples

			a(1)  = 1  via [1]
a(2)  = 1  via [1,2]
a(3)  = 2  via [1,2,3]
a(4)  = 4  via [1,3,2,4]
a(5)  = 5  via [1,2,4,3,5]
a(6)  = 9  via [1,4,2,5,3,6]
a(7)  = 6  via [1,2,3,4,6,5,7]
a(8)  = 16 via [1,5,2,6,3,7,4,8]
a(9)  = 9  via [1,2,3,4,6,5,8,7,9]
a(10) = 25 via [1,6,2,7,3,8,4,9,5,10]
For n=4, the first player would take 4, the second player would take 2, the first player would take 3, and the second player would take 1. The resulting score difference would be 4 - 2 + 3 - 1 = 4.
		

References

  • Peter Winkler, Mathematical Puzzles: A Connoisseur's Collection, A K Peters/CRC Press, 2003, pages 1-2.

Crossrefs

Cf. A276164.

Programs

  • Haskell
    minimax [] = 0
    minimax as = max (head as - minimax (tail as)) (last as - minimax (init as))
    a276163 n = maximum $ map minimax $ permutations [1..n]

Extensions

a(11)-a(16) from Bert Dobbelaere, May 03 2025

A276165 a(n) is the first-player score difference of a "Coins in a Row" game over the n-th row of A066099 using a minimax strategy.

Original entry on oeis.org

0, 1, 2, 0, 3, 1, 1, 1, 4, 2, 0, 2, 2, 0, 2, 0, 5, 3, 1, 3, 1, 1, 1, 1, 3, -1, 1, 1, 3, 1, 1, 1, 6, 4, 2, 4, 0, 2, 2, 2, 2, 0, 2, 0, 2, 2, 0, 2, 4, -2, 0, 2, 2, 0, 2, 0, 4, 2, 0, 0, 2, 0, 2, 0, 7, 5, 3, 5, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 3, 3, -1, 1, 1, 3, 1
Offset: 0

Views

Author

Peter Kagey, Aug 25 2016

Keywords

Comments

"Coins in a Row" is a game in which players alternate picking up coins of varying denominations from the end of the row in an attempt to collect as many points as possible.
When a(n) is negative, the second player has a strategy that is guaranteed to collect more points.

Examples

			Let [R,L,L,L] represent a game in which the first player takes the right coin, the second player takes the left coin, the first player takes the left coin, and the second player takes the left (only remaining) coin.
A066099_Row(0)    = [0];         a(0)    = 0  via [L]
A066099_Row(1)    = [1];         a(1)    = 1  via [L]
A066099_Row(3)    = [1,1];       a(3)    = 0  via [R,L]
A066099_Row(22)   = [2,1,2];     a(22)   = 1  via [L,R,L]
A066099_Row(88)   = [2,1,4];     a(88)   = 3  via [R,L,L]
A066099_Row(1418) = [2,1,4,2,2]; a(1418) = -1 via [L,R,R,R,L]
		

References

  • Peter Winkler, Mathematical Puzzles: A Connoisseur's Collection, A K Peters/CRC Press, 2003, pages 1-2.

Crossrefs

Programs

  • Haskell
    minimax [] = 0
    minimax as = max (head as - minimax (tail as)) (last as - minimax (init as))
    a276165 = minimax . a066099_row

Formula

a(n) = A276166(n) - A276167(n).

A276166 a(n) is the first player's score in a "Coins in a Row" game over the n-th row of A066099 using a minimax strategy.

Original entry on oeis.org

0, 1, 2, 1, 3, 2, 2, 2, 4, 3, 2, 3, 3, 2, 3, 2, 5, 4, 3, 4, 3, 3, 3, 3, 4, 2, 3, 3, 4, 3, 3, 3, 6, 5, 4, 5, 3, 4, 4, 4, 4, 3, 4, 3, 4, 4, 3, 4, 5, 2, 3, 4, 4, 3, 4, 3, 5, 4, 3, 3, 4, 3, 4, 3, 7, 6, 5, 6, 4, 5, 5, 5, 4, 4, 5, 4, 4, 5, 4, 5, 5, 3, 4, 4, 5, 4, 4
Offset: 0

Views

Author

Peter Kagey, Aug 25 2016

Keywords

Comments

"Coins in a Row" is a game in which players alternate picking up coins of varying denominations from the end of the row in an attempt to collect as many points as possible.

Examples

			Let [R,L,L,L] represent a game in which the first player takes the right coin, the second player takes the left coin, the first player takes the left coin, and the second player takes the left (only remaining) coin.
A066099_Row(0)    = [0];         a(0)    = 0 via [L]
A066099_Row(1)    = [1];         a(1)    = 1 via [L]
A066099_Row(3)    = [1,1];       a(3)    = 1 via [R,L]
A066099_Row(22)   = [2,1,2];     a(22)   = 3 via [L,R,L]
A066099_Row(88)   = [2,1,4];     a(88)   = 5 via [R,L,L]
A066099_Row(1418) = [2,1,4,2,2]; a(1418) = 5 via [L,R,R,R,L]
		

References

  • Peter Winkler, Mathematical Puzzles: A Connoisseur's Collection, A K Peters/CRC Press, 2003, pages 1-2.

Crossrefs

Programs

  • Haskell
    minimaxDifference [] = 0
    minimaxDifference as = max (head as - minimaxDifference (tail as)) (last as - minimaxDifference (init as))
    minimaxScore as = (sum as + minimaxDifference as) `div` 2
    a276166 = minimaxScore . a066099_row

Formula

a(n) = A029837(n + 1) - A276167(n).
a(n) = A276165(n) + A276167(n).

A276167 a(n) is the second player's score in a "Coins in a Row" game over the n-th row of A066099 using a minimax strategy.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 2, 1, 1, 2, 1, 2, 0, 1, 2, 1, 2, 2, 2, 2, 1, 3, 2, 2, 1, 2, 2, 2, 0, 1, 2, 1, 3, 2, 2, 2, 2, 3, 2, 3, 2, 2, 3, 2, 1, 4, 3, 2, 2, 3, 2, 3, 1, 2, 3, 3, 2, 3, 2, 3, 0, 1, 2, 1, 3, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 2, 2, 4, 3, 3, 2, 3, 3
Offset: 0

Views

Author

Peter Kagey, Aug 25 2016

Keywords

Comments

"Coins in a Row" is a game in which players alternate picking up coins of varying denominations from the end of the row in an attempt to collect as many points as possible.

Examples

			Let [R,L,L,L] represent a game in which the first player takes the right coin, the second player takes the left coin, the first player takes the left coin, and the second player takes the left (only remaining) coin.
A066099_Row(0)    = [0];         a(0)    = 0 via [L]
A066099_Row(1)    = [1];         a(1)    = 0 via [L]
A066099_Row(3)    = [1,1];       a(3)    = 1 via [R,L]
A066099_Row(22)   = [2,1,2];     a(22)   = 2 via [L,R,L]
A066099_Row(88)   = [2,1,4];     a(88)   = 2 via [R,L,L]
A066099_Row(1418) = [2,1,4,2,2]; a(1418) = 6 via [L,R,R,R,L]
		

References

  • Peter Winkler, Mathematical Puzzles: A Connoisseur's Collection, A K Peters/CRC Press, 2003, pages 1-2.

Crossrefs

Programs

  • Haskell
    minimaxDifference [] = 0
    minimaxDifference as = max (head as - minimaxDifference (tail as)) (last as - minimaxDifference (init as))
    minimaxScore2 as = (sum as - minimaxDifference as) `div` 2
    a276167 = minimaxScore2 . a066099_row

Formula

a(n) = A029837(n + 1) - A276166(n).
a(n) = A276166(n) - A276165(n).
Showing 1-4 of 4 results.