Super Ramvok

Consider a single game of Ramvok:
Let $t$ represent the maximum number of turns the game lasts. If $t = 0$, then the game ends immediately. Otherwise, on each turn $i$, the player rolls a die. After rolling, if $i \lt t$ the player can either stop the game and receive a prize equal to the value of the current roll, or discard the roll and try again next turn. If $i = t$, then the roll cannot be discarded and the prize must be accepted. Before the game begins, $t$ is chosen by the player, who must then pay an up-front cost $ct$ for some constant $c$. For $c = 0$, $t$ can be chosen to be infinite (with an up-front cost of $0$). Let $R(d, c)$ be the expected profit (i.e. net gain) that the player receives from a single game of optimally-played Ramvok, given a fair $d$-sided die and cost constant $c$. For example, $R(4, 0.2) = 2.65$. Assume that the player has sufficient funds for paying any/all up-front costs.
Now consider a game of Super Ramvok:
In Super Ramvok, the game of Ramvok is played repeatedly, but with a slight modification. After each game, the die is altered. The alteration process is as follows: The die is rolled once, and if the resulting face has its pips visible, then that face is altered to be blank instead. If the face is already blank, then it is changed back to its original value. After the alteration is made, another game of Ramvok can begin (and during such a game, at each turn, the die is rolled until a face with a value on it appears). The player knows which faces are blank and which are not at all times. The game of Super Ramvok ends once all faces of the die are blank.
Let $S(d, c)$ be the expected profit that the player receives from an optimally-played game of Super Ramvok, given a fair $d$-sided die to start (with all sides visible), and cost constant $c$. For example, $S(6, 1) = 208.3$.
Let $F(n) = \sum_{4 \le d \le n} \sum_{0 \le c \le n} S(d, c)$.
Calculate $F(20)$, rounded to the nearest integer.

To solve this problem, we can use dynamic programming to calculate the expected number of squares traveled by Bob in a single optimally-played game.

First, let’s define a function `calculate_moves` that takes the number of disks `n`, the width of the room `k`, and the positions of the rods `a`, `b`, `c`, and returns the expected number of squares traveled by Bob in an optimal game.

“`python
def calculate_moves(n, k, a, b, c):
memo = {} # memoization dictionary to store calculated values

def dp(n, b):
# Base case: if there are no disks left, no moves are needed
if n == 0:
return 0

# Check if the sub-problem has already been solved
if (n, b) in memo:
return memo[(n, b)]

# Calculate the expected number of moves for the sub-problem
expected_moves = float(‘inf’) # start with a large value

# Calculate number of moves if Bob picks up a disk from rod ‘b’
for a_or_c in [a, c]:
# Calculate the number of squares required to reach rod ‘a/c’ from rod ‘b’
squares_required = abs(b – a_or_c)

# Calculate the number of picks required to move the top disk from rod ‘b’ to rod ‘a/c’
picks_required = dp(n – 1, a_or_c)

# Total number of moves required for this move
total_moves = squares_required + picks_required

# Update the expected minimum moves
expected_moves = min(expected_moves, total_moves)

# Calculate number of moves if Bob puts down a disk onto rod ‘b’
for a_or_c in [a, c]:
# Calculate the number of squares required to reach rod ‘b’ from rod ‘a/c’
squares_required = abs(b – a_or_c)

# Calculate the number of picks required to move the top disk from rod ‘a/c’ to rod ‘b’
picks_required = dp(n – 1, b)

# Total number of moves required for this move
total_moves = squares_required + picks_required

# Update the expected minimum moves
expected_moves = min(expected_moves, total_moves)

# Memoize the result
memo[(n, b)] = expected_moves

return expected_moves

return dp(n, b)
“`

Now, we can calculate the sum

“`python
s = 0 # stores the sum of last nine digits
for n in range(1, 10001):
moves = calculate_moves(n, 10 ** n, 3 ** n, 6 ** n, 9 ** n)
s += moves

# Get the last nine digits of the sum
result = s % int(1e9)
“`

The variable `result` will store the last nine digits of the required sum.

Note: Since the recursive solution involves overlapping subproblems, the dynamic programming approach with memoization allows us to efficiently solve larger instances of the problem. However, computing the sum for `n = 10000` might take a while as it involves a large number of calculations.

More Answers:
Superinteger
Smooth Divisors of Binomial Coefficients
Empty Chairs

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Don't Miss Out! Sign Up Now!

Sign up now to get started for free!