TL;DR
If you decide on a random move, the probability that the same move will appear 5 times in a row at least once in 30 years is
The theoretical value is 99.999999%
, and the measured value is 99.999%
.
Nevertheless, Sazae-san has never put out the same hand five times in a row for 30 years.
Sazae-san is random and not rock-paper-scissors. There is a person inside.
As I learned on Twitter, as shown in ↓, when I went around with "Sazae-san" and "rock-paper-scissors", the same hand of rock-paper-scissors appeared five times in a row, the first in 30 years of history. I will. https://nlab.itmedia.co.jp/nl/articles/2006/08/news108.html
For the first time in 30 years, I feel that it is super rare, but in fact, I will try "calculation (theory)" + "trial (actual measurement)" to see how rare it is. (Since the tool that can be used quickly at hand was Ruby, I wrote it in Ruby)
Which move to play with rock-paper-scissors is completely random (rand (3)
equivalent randomness)
First of all, the probability of getting the same hand of rock-paper-scissors five times in a row is Any first move (1) x 4 same moves (1/3 to the 4th power) Because it becomes
SERIES_COUNT = 5 #5 times in a row
rate_5 = 1.0 * (1.0 / 3.0) ** (SERIES_COUNT - 1)
=> 0.012345679012345677
It's about 1.2%
.
Rock-paper-scissors once a week, the first in 30 years of history, so the number of rock-paper-scissors so far is
1 [janken/week] * 30 [year] * 52 [week/year] = 1560 [janken]
It becomes.
The probability that you will get the same hand 5 times in a row even once after playing rock-paper-scissors 1560 times
1-(Probability of not getting the same hand 5 times in a row out of 1560 times)
You can think of it as.
Also, of the 1560 times, the last 4 times will not be 5 consecutive times, so
The number of times you can challenge the same hand 5 times in a row out of 1560 times
1560 - (5 - 1) = 1556
It becomes.
For example, if it is 10 times in total, the image of trying ↓ 10-(5-1) = 6
times.
●●●●●○○○○○
○●●●●●○○○○
○○●●●●●○○○
○○○●●●●●○○
○○○○●●●●●○
○○○○○●●●●●
The probability of not getting the same hand 5 times in a row is
1-(Probability of getting the same move 5 times in a row)
So
1 - 0.012345679012345677
Will be
Of the 1560 times, the probability that the same move will not be made 5 times in a row means that the probability of ↑ will be 1556 times in a row.
(1 - 0.012345679012345677) ^1556 = 0.00000000403024
It becomes.
The probability of getting the same hand 5 times in a row even once in 1560 rock-paper-scissors is
1 - 0.00000000403024 = 0.99999999596976
I can't go to Eleven Nine, but Eight Nine is almost 100%. If you play rock-paper-scissors every week for 30 years, you will have the same hand at least once five times in a row.
The one that let Ruby calculate
YEARS = 30
WEEKS_PER_YEAR = 52
SERIES_COUNT = 5
trial_probability = 1.0 * (1.0 / 3.0) ** (SERIES_COUNT - 1)
trial_n = YEARS * WEEKS_PER_YEAR
total_no_hit_probability = (1.0 - trial_probability) ** (trial_n - SERIES_COUNT + 1)
total_hit_probability = 1 - total_no_hit_probability
total_hit_probability
=> 0.9999999959697649
Play rock-paper-scissors 1560 times with brute force to see if the same hand is out 5 times in a row. Try 1 million times and measure how many times you get the same hand for 5 consecutive times.
The one who let Ruby try
YEARS = 30
WEEKS_PER_YEAR = 52
SERIES_COUNT = 5
#A function that checks if the same value is consecutive 5 times in the passed array
def check_serial_same_5(values)
hit_count = 0
(values.size - SERIES_COUNT + 1).times { |i|
if values[i] == values[i + 1] &&
values[i] == values[i + 2] &&
values[i] == values[i + 3] &&
values[i] == values[i + 4]
hit_count += 1
end
}
return hit_count
end
N = 1000000 #1 million trials
total_hit = 0 #Number of times the same hand was made 5 times in a row out of 1 million times
N.times {
#Rock-paper-scissors for 30 years
values = []
(YEARS * WEEKS_PER_YEAR).times {
values << rand(3) #Rock-paper-scissors hand rand(3)Alternative with
}
hit = check_serial_same_5(values)
if hit != 0
total_hit += 1
end
}
real_trial_probability = total_hit.to_f / N.to_f
real_trial_probability
=> 0.999998 #1st 1 million trials
=> 1.0 #Second trial of one million trials
=> 0.999996 #3rd trial of 1 million times
In principle, if you try 1 million times, it will not be eight nines, but This is also almost 100%. If you play rock-paper-scissors every week for 30 years, you will have the same hand at least once five times in a row.
Rock-paper-scissors every week for 30 years, at least once, the probability of getting the same hand 5 times in a row,
I tried it 1 billion times and confirmed it.
Result is,
0.999998264
The probability is almost the same as 1 million trials (five nines).
Sazae-san, who has been playing rock-paper-scissors every week for about 30 years, The fact that I've never done the same thing five times in a row Sazae-san isn't deciding what to do at random. It suggests that the will of a person may intervene there.
If you've been playing rock-paper-scissors every week for 30 years at completely random, you should have a 99.999% or higher chance of getting the same hand 5 times in a row. Contrary to theory means that human will is involved.
When the integers n, N, are n <N, Probability of playing rock-paper-scissors N times and having the same hand n times in a row It is a little suspicious whether the calculation of is correct by the method described in ↑.
N = 10 n = 5 At that time, the number of lottery is 6 times to see if the same hand can be obtained 5 times in a row.
The theoretical value is eight nine and the measured value is five nine, which is almost the same in the sense that it is almost 100%. Since the precision is different in digits, there is a possibility that the calculation of the theoretical value is incorrect.
Does that mean that there are other conditions that are lower than the probability calculated in ↑ (= more difficult to get the same hand in a row)? .. ..
---///
Recommended Posts