A roulette player had a system of playing one dollar 7 times, red or black, then 7 dollars 7 times, red or black, then 49 dollars 7 times, red or black, etc., each time 7 bets in increasing powers of 7.
How many times had he won if he finally won net 777,777 dollars?
For those not familiar with the roulette, in this particular bet, if you bet 1 dollar, either you lose it or gain another 1 dollar.
(In reply to
re: solution by Dej Mar)
The following program finds the same four sets as Dej Mar:
FOR w1 = 0 TO 7: l1 = 7 - w1
FOR w2 = 0 TO 7: l2 = 7 - w2
FOR w3 = 0 TO 7: l3 = 7 - w3
FOR w4 = 0 TO 7: l4 = 7 - w4
FOR w5 = 0 TO 7: l5 = 7 - w5
FOR w6 = 0 TO 7: l6 = 7 - w6
FOR w7 = 0 TO 7: l7 = 7 - w7
win = (((((((w7 - l7) * 7 + (w6 - l6)) * 7 + (w5 - l5)) * 7 + (w4 - l4)) * 7 + (w3 - l3)) * 7 + (w2 - l2)) * 7 + (w1 - l1))
IF win = 777777 THEN
PRINT w1; w2; w3; w4; w5; w6; w7, w1 + w2 + w3 + w4 + w5 + w6 + w7
END IF
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
FOR i = 0 TO 7
PRINT 7 ^ i
NEXT
wins:
0 4 2 0 5 2 7 20
0 4 2 7 4 2 7 26
7 3 2 0 5 2 7 26
7 3 2 7 4 2 7 32
The ambiguity is the result of having 8 possible values at each position in a base-7 system.
|
Posted by Charlie
on 2008-07-14 11:11:26 |