# Puzzler: car digital clocks, 3 matching digits per 24 hour period

Interestingly, digital clocks have different time formats for the hours; 12hr vs 24hr, and some pad the hours with leading zeros, some don’t (e.g. 01:00 vs 1:00).

With these two possibilities, this would make a total of 4 possible answers.

1. For a “typical” 12 hour am/pm clock that doesn’t pad the hours digit, you’ll get 48 matches in a 24 hour period, as per the aired puzzler (show #1119).

2. For a 12 hour am/pm clock that pads leading zeros (e.g. 01:00) it seems there are 66 matches. (This gives 18 extra matches; 9 per 12 hour period – 01:00, 02:00…09:00)

3. For a clock that reads 24 hour time with no padding (0:00, 1:00…) it seems there are 56 matches.

4. For a clock that reads 24 hour time with padding (00:00, 01:00) it seems there are 79 matches. (This gives 23 more matches than unpadded)

I can follow up with some one liner perl scripts that show these variations if anyone is curious, assuming I didn’t screw anything up.

For a typical 12 hr clock, 11:11 shouldn’t count. The puzzler asked for times using the same digit 3 times. (Not 3 or more times.) 11:11 uses the same digit 4 times, not 3. The real answer should have been 46, not 48.

Goldwing 4:36PM

I think their argument is that, if the digit appears 4 times, it certainly appears 3 times.

Another puzzle along the same lines is: How many digital displays are palindromic (if that can be a fair characterization of a number), like 5:05 (and not getting too hung up about the colon)? There are probably too many right answers to count easily, and that might make it too tedious for a good puzzle.

I like: With a standard display, which time(s) show the greatest number of pips turned on? It’s probably not tedious enough.

They said “appears 3 times.” 3 means exactly 3, 4 is different from 3. They should say what they mean, and mean what they say.

Calm down. Four is a superset of three. Does the digit “1” appear one time in 11:11? By your logic it does not. It does not occur once in 11:11. Yet there it is.

By the way, he buys one of each wiper.

How, exactly, does “3” mean “exactly 3”? “Exactly 3” means “exactly 3”, but you need the word “exactly” to make it so. “I can think of three reasons why,” doesn’t mean I can’t think of more. This is not one of my favorite exchanges, by the way.

The “1” one appears 3 times and 4 times both at the same time. So the answer was correct.

unxguy 4:07PM

I had to look up “perl script” to see what you were talking about. I wouldn’t mind seeing some one-liners.

You don’t want to see that.
#\$%(#\$%%&^(((??&#%()#&%|W&\$%?</ <- that’s how intelligible it’ll be.

Let’s move on to the present and talk about wiping!

I’m not sure which blades Jim bought, but I’ll bet he measured too long on one side and too short on the other. Some cars have two different size blades on the windshield, so he measured one (say, the right side) and tried to put it on the other side. If he had gone to a proper parts store, of course, they’d had had a book with all the user replaceable parts (ie, his wiper blades)

I was also noticing argument regarding the verbiage of the clock puzzler. The puzzler says verbatim, “how many times during the course of a complete day (24-hours) does a car’s digital clock display a time that has three of the same digit.”. It does not ask how many CONSECUTIVE numbers, just how many times three of the same number appear. Since you have to have three of the same number to have four of the same number, the ones with four of the same still counts. I hope you didn’t lose a bet on this one.

Zingophoto: your argument about CONSECUTIVE numbers doesn’t address the objection that four is not three. That’s 30 seconds you’ll never get back, assuming you’re an average typist.

As for the wipers, really? A book? Okay.

Here’s what happened. He “turned back” from the door to the store, measured the passenger side wiper, then later decided to put on only one wiper, which of course would be the driver’s side. He measured correctly on each side.

0-2.

Unxguy:
I’m interested in the perl script that would calculate this. Please post it.

Cheaper to just hire someone in India to count the digits.

Did I count wrong?
12:11,
12:22,
1:11,
2:22,
3:33,
4:44,
5:55,
10:00,
10:11,
11:01.
11:10.
11:11
11:12,
11:13,
11:14,
11:15,
11:16,
11:17,
11:18,
11:19,
11:20,
11:21,
11:31,
11:41,
11:51,
and that adds up to 24? Or is it 25 making it 50
Dang that new math!

Yes, you counted wrong.

OK, will follow up with the perl code in next posting…

As per a few requests; perl one liner’s follow, one for each of the four cases.

Yes, as piter_devries mentioned, perl code is very !@#(*. But some folks would probably want to play with it. It can be written many different ways.

First, here’s a table of output from the four scripts showing the matching times.
Below the table are the 4 one liner perl scripts that print the different reports.
When executed, each will print the matching times. If you’re familiar with the terminal, you can pipe the output through wc to get the counts, or pipe into other tools to generate the table.

BTW, times like 11:11 only counts as a single match. (I believe in show #1119 they made a point of this)

First, the 4 reports I ended up with showing the results. (I’m hoping the formatting alignment of the table is maintained when posted)

```    12hr/nopad  12hr/pad        24hr/nopad      24hr/pad
----------  --------        ----------      --------
1) 1:11 am     01:00 am        0:00            00:00
2) 2:22 am     01:11 am        1:11            00:01
3) 3:33 am     02:00 am        2:22            00:02
4) 4:44 am     02:22 am        3:33            00:03
5) 5:55 am     03:00 am        4:44            00:04
6) 10:00 am    03:33 am        5:55            00:05
7) 10:11 am    04:00 am        10:00           00:06
8) 11:01 am    04:44 am        10:11           00:07
9) 11:10 am    05:00 am        11:01           00:08
10) 11:11 am    05:55 am        11:10           00:09
11) 11:12 am    06:00 am        11:11           00:10
12) 11:13 am    07:00 am        11:12           00:20
13) 11:14 am    08:00 am        11:13           00:30
14) 11:15 am    09:00 am        11:14           00:40
15) 11:16 am    10:00 am        11:15           00:50
16) 11:17 am    10:11 am        11:16           01:00
17) 11:18 am    11:01 am        11:17           01:11
18) 11:19 am    11:10 am        11:18           02:00
19) 11:21 am    11:11 am        11:19           02:22
20) 11:31 am    11:12 am        11:21           03:00
21) 11:41 am    11:13 am        11:31           03:33
22) 11:51 am    11:14 am        11:41           04:00
23) 12:11 am    11:15 am        11:51           04:44
24) 12:22 am    11:16 am        12:11           05:00
25) 1:11 pm     11:17 am        12:22           05:55
26) 2:22 pm     11:18 am        13:11           06:00
27) 3:33 pm     11:19 am        13:33           07:00
28) 4:44 pm     11:21 am        14:11           08:00
29) 5:55 pm     11:31 am        14:44           09:00
30) 10:00 pm    11:41 am        15:11           10:00
31) 10:11 pm    11:51 am        15:55           10:11
32) 11:01 pm    12:11 am        16:11           11:01
33) 11:10 pm    12:22 am        17:11           11:10
34) 11:11 pm    01:00 pm        18:11           11:11
35) 11:12 pm    01:11 pm        19:11           11:12
36) 11:13 pm    02:00 pm        20:00           11:13
37) 11:14 pm    02:22 pm        20:22           11:14
38) 11:15 pm    03:00 pm        21:11           11:15
39) 11:16 pm    03:33 pm        21:22           11:16
40) 11:17 pm    04:00 pm        22:02           11:17
41) 11:18 pm    04:44 pm        22:12           11:18
42) 11:19 pm    05:00 pm        22:20           11:19
43) 11:21 pm    05:55 pm        22:21           11:21
44) 11:31 pm    06:00 pm        22:22           11:31
45) 11:41 pm    07:00 pm        22:23           11:41
46) 11:51 pm    08:00 pm        22:24           11:51
47) 12:11 pm    09:00 pm        22:25           12:11
48) 12:22 pm    10:00 pm        22:26           12:22
49)             10:11 pm        22:27           13:11
50)             11:01 pm        22:28           13:33
51)             11:10 pm        22:29           14:11
52)             11:11 pm        22:32           14:44
53)             11:12 pm        22:42           15:11
54)             11:13 pm        22:52           15:55
55)             11:14 pm        23:22           16:11
56)             11:15 pm        23:33           17:11
57)             11:16 pm                        18:11
58)             11:17 pm                        19:11
59)             11:18 pm                        20:00
60)             11:19 pm                        20:22
61)             11:21 pm                        21:11
62)             11:31 pm                        21:22
63)             11:41 pm                        22:02
64)             11:51 pm                        22:12
65)             12:11 pm                        22:20
66)             12:22 pm                        22:21
67)                                             22:22
68)                                             22:23
69)                                             22:24
70)                                             22:25
71)                                             22:26
72)                                             22:27
73)                                             22:28
74)                                             22:29
75)                                             22:32
76)                                             22:42
77)                                             22:52
78)                                             23:22
79)                                             23:33
```

…and here’s the one liner’s, with comments for what each report does.

```# 1) 12 HOURS (am/pm): NO PADDING
perl -e 'sub FindTime(\$\$) { my(\$h,\$ampm) = @_; for ( \$m=0; \$m<60; \$m++ ) { \$s = sprintf("%d:%02d %s",\$h,\$m,\$ampm); foreach \$d ( split(//,"0123456789") ) { if ( \$s =~ /\$d.*\$d.*\$d/ ) { print("Time: \$s
"); } } } } foreach \$ampm ( "am", "pm" ) { for ( \$h=1; \$h<=12; \$h++ ) { FindTime(\$h,\$ampm); } }'

# 2) 12 HOURS (am/pm): WITH PADDING
perl -e 'sub FindTime(\$\$) { my(\$h,\$ampm) = @_; for ( \$m=0; \$m<60; \$m++ ) { \$s = sprintf("%02d:%02d %s",\$h,\$m,\$ampm); foreach \$d ( split(//,"0123456789") ) { if ( \$s =~ /\$d.*\$d.*\$d/ ) { print("Time: \$s
"); } } } } foreach \$ampm ( "am", "pm" ) { for ( \$h=1; \$h<=12; \$h++ ) { FindTime(\$h,\$ampm); } }'

# 3) 24 HOUR TIME: NO PADDING
perl -e 'sub FindTime(\$) { my(\$h) = @_; for ( \$m=0; \$m<60; \$m++ ) { \$s = sprintf("%d:%02d %s",\$h,\$m); foreach \$d ( split(//,"0123456789") ) { if ( \$s =~ /\$d.*\$d.*\$d/ ) { print("Time: \$s
"); } } } } for ( \$h=0; \$h<=23; \$h++ ) { FindTime(\$h); }'

# 4) 24 HOUR TIME: WITH PADDING
perl -e 'sub FindTime(\$) { my(\$h) = @_; for ( \$m=0; \$m<60; \$m++ ) { \$s = sprintf("%02d:%02d %s",\$h,\$m); foreach \$d ( split(//,"0123456789") ) { if ( \$s =~ /\$d.*\$d.*\$d/ ) { print("Time: \$s
"); } } } } for ( \$h=0; \$h<=23; \$h++ ) { FindTime(\$h); }'
```

Otay, I agree, sort of. I counted right. I just counted the wrong thing. You see, I counted “Ray’s solution” to the answer. And, in fitting in with the general aire of the shoe, Ray had the correct answer. The error was in the diagnosis of the solution. It seems that '20 (11:20) slipped out between '19 and '21.

Oh well. It’s not the first time there was a screw leftover. when the job was done.