OFFSET
1,2
COMMENTS
Players A and B bet in a k-round game. Player A has an initial amount of money n. In each round, player A can wager an integer between 0 and what he has. Player A then gains or loses an amount equal to his wager depending on whether player B lets him win or lose. Player B tries to minimize player A's money at the end. The number of rounds player A can lose is r. a(n) is the maximum amount of money player A can have at the end of the game for k = 4 and r = 1. Note that with a(0)=0, a(n+1)-a(n) is a periodic function of n with value = 1,4,3,4,4.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..10000
Charles Jwo-Yue Lien, Dynamic Betting Game, Southeast Asian Bulletin of Mathematics, 2015, Vol. 39 Issue 6, pp. 799-814.
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,1,-1).
FORMULA
a(n) = floor(8*n/5) + 2*floor(4*n/5).
a(n) = a(n-1) + a(n-5) - a(n-6). - Colin Barker, Sep 11 2014
G.f.: x*(x+1)*(4*x^3+3*x+1) / ((x-1)^2*(x^4+x^3+x^2+x+1)). - Colin Barker, Sep 11 2014
EXAMPLE
In the case of n=2: For the 1st round, player A bets 1. B will let A win, otherwise A will end up with 8 by betting all he has for the last 3 rounds. For the 2nd round, A has 3 and bets 1. B will let A win, otherwise A will end up with 8 by betting all he has for the last 2 rounds. For the 3rd round, A has 4 and bets 1. B will let A win, otherwise A will end up with 6 by betting all he has at the last round. For the 4th round, A has 5 and bets 0. So A ends up with 5. If A bets more than 1 in any of the prior rounds, B will let A lose and A will have fewer than 5 at the end. So a(2) = 5.
MATHEMATICA
Table[(Floor[8 n/5] + 2 Floor[4 n/5]), {n, 60}] (* Vincenzo Librandi, Sep 14 2014 *)
LinearRecurrence[{1, 0, 0, 0, 1, -1}, {1, 5, 8, 12, 16, 17}, 60] (* Harvey P. Dale, Jun 07 2020 *)
PROG
(PARI)
vector(100, n, floor(8*n/5)+2*floor(4*n/5)) \\ Derek Orr, Sep 11 2014
(PARI)
Vec(x*(x+1)*(4*x^3+3*x+1)/((x-1)^2*(x^4+x^3+x^2+x+1)) + O(x^100)) \\ Colin Barker, Sep 11 2014
(Magma) [Floor(8*n/5) + 2*Floor(4*n/5): n in [1..60]]; // Vincenzo Librandi, Sep 14 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Charles Jwo-Yue Lien, Sep 10 2014
STATUS
approved