login
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.
3

%I #17 Aug 27 2016 02:11:16

%S 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,

%T 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,

%U 3,2,2,2,3,3,2,3,3,2,3,2,2,4,3,3,2,3,3

%N 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.

%C "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.

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

%H Peter Kagey, <a href="/A276167/b276167.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = A029837(n + 1) - A276166(n).

%F a(n) = A276166(n) - A276165(n).

%e 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.

%e A066099_Row(0) = [0]; a(0) = 0 via [L]

%e A066099_Row(1) = [1]; a(1) = 0 via [L]

%e A066099_Row(3) = [1,1]; a(3) = 1 via [R,L]

%e A066099_Row(22) = [2,1,2]; a(22) = 2 via [L,R,L]

%e A066099_Row(88) = [2,1,4]; a(88) = 2 via [R,L,L]

%e A066099_Row(1418) = [2,1,4,2,2]; a(1418) = 6 via [L,R,R,R,L]

%o (Haskell)

%o minimaxDifference [] = 0

%o minimaxDifference as = max (head as - minimaxDifference (tail as)) (last as - minimaxDifference (init as))

%o minimaxScore2 as = (sum as - minimaxDifference as) `div` 2

%o a276167 = minimaxScore2 . a066099_row

%Y Cf. A276163, A276164, A276165, A276166.

%K nonn

%O 0,11

%A _Peter Kagey_, Aug 25 2016