On a digital clock showing 00:00 to 23:59, what is the probability of having exactly three identical digits?
5 Answers
Number of qualifying times:
00:0# (9)
00:#0 (5)
0#:00 (9)
#0:00 (2)
11:1# (9)
11:#1 (5)
1#:11 (9)
#1:11 (2)
22:2# (9)
22:#2 (5)
2#:22 (3)
#2:22 (2)
#3:33 (3)
#4:44 (2)
#5:55 (2)
Total: 76 qualifying times
Probability:
76/1440 = 19/360, approximately 5.28%
-
$\begingroup$ More elegant and correct than my attempt. I had a feeling I was missing a few big sets like 00:0# and 22:2#.. $\endgroup$ Aug 4, 2020 at 4:08
Update: There was a mistake in my original answer. I fixed it and now my answer agrees with (and essentially duplicates) Daniel Mathias's answer.
Qualifying times:
00:01
00:02
00:03
00:04
00:05
00:06
00:07
00:08
00:09
00:10
00:20
00:30
00:40
00:50
01:00
01:11
02:00
02:22
03:00
03:33
04:00
04:44
05:00
05:55
06:00
07:00
08:00
09:00
10:00
10:11
11:01
11:10
11:12
11:13
11:14
11:15
11:16
11:17
11:18
11:19
11:21
11:31
11:41
11:51
12:11
12:22
13:11
13:33
14:11
14:44
15:11
15:55
16:11
17:11
18:11
19:11
20:00
20:22
21:11
21:22
22:02
22:12
22:20
22:21
22:23
22:24
22:25
22:26
22:27
22:28
22:29
22:32
22:42
22:52
23:22
23:33
Number of qualifying times:
76
Probability of having exactly three identical digits:
76 / 1440 = approximately 5.28%
I came up with a solution using Ruby
require 'time'
MINUTES_IN_A_DAY = 1_439
time = Time.parse('00:00')
three_of_same_count = 0
MINUTES_IN_A_DAY.times do
counts = time.strftime('%H%M').each_char.with_object(Hash.new(0)) do |c, o|
o[c] += 1
end
three_of_same_count += 1 if counts.values.max == 3
time += 60 # seconds
end
puts "Number of occurrences #{three_of_same_count}"
puts "#{((three_of_same_count.to_f / MINUTES_IN_A_DAY) * 100).round(3)}% of all occurrences"
Output:
Number of occurrences 76
5.281% of all occurrences
-
1$\begingroup$ I think your "minutes in a day" is off... this is the "seconds in a day" value... therefor your total number is times 60 to large... but as your overall count is off the same amount your percentage is ok after all... $\endgroup$– TodeAug 5, 2020 at 13:52
-
Let me give a differnt interpretation: Ther times of interest are
0:00
1:11
2:22
3:33
4:44
5:55
No other time formats exist that conain exactly 3 same digits.
Total number of possible digit combinations:
24 * 60 = 1440
Total probability
6 / 1440 = 1 / 240 = 0.417%
Edit: Explanation for the selection of possible times:
In general we are looking for any time that consists of 3 digits only. Thus any time later than (0)9:59 is out of scope. (The times 10:00 and onwards have all 4 digits.) The remining pairs are 0:00, 1:11, ..., 5:55, 6:66,..., 9:99 (theoretically). Obviously the cases 6:66 until 9:99 are not plausible as minutes past 59 are not valid.
Thank you @MacGyver88 for the hint. I seem to have been to tierd to think straight ahead.
-
1$\begingroup$ Hello and welcome to Puzzling. Can you please explain why those are the only 2 options? I may be the only one, but I don't understand unless your clock fell and the display was broken somehow. I'm all for that but you may want to elaborate a little bit. $\endgroup$ Aug 4, 2020 at 14:51
-
2$\begingroup$ The problem specifically states the numbers start at 00:00 not 0:00 so looks like the leading zero is always present, so according to your logic the probability would have to be 0%! $\endgroup$– AmorydaiAug 5, 2020 at 4:49
-
$\begingroup$ You are right, I thought not of that. $\endgroup$ Sep 12, 2020 at 11:53
There are four digits, but the 1st and 3rd digits are constrained to only be 0..5. Hence to get three identical digits D, D would have to be in range D=0..5 And there are 24*60 legal (four-digit) times, in total.
Case a) when there is a leading zero digit, so e.g. 7am is represented as 07:00
not 7:00
:
Then 10/24 of the time the first digit is '0', 10/24 it's '1', and 4/24 it's '2'. So 20/24 of the time it's '0' or '1' and 4/24 it's '2'.
P(3 identical digits) = ([number of legal times with three identical digits where first digit is 0 or 1] + [number of legal times with first digit 2]) / 24*60 ...and the rest is combinatorics and algebra
Case b) when there isn't a leading zero digit, so e.g. 7am is represented as 7:00
not 07:00
:
Then 10/24 of the time the first digit doesn't exist (so there are only three digits), 10/24 it's '1', and 4/24 it's '2'.
P(3 identical digits) = ([number of legal times without first digit, with three identical digits] + [number of legal times with three identical digits where first digit is 1] + [number of legal times with three identical digits where first digit is 2]) / 24*60 and the rest is combinatorics and algebra
07:00
or7:00
? $\endgroup$07:00
or7:00
??? You should clarify things like that promptly. Otherwise the question has multiple solutions. $\endgroup$