Today’s date written in MM/DD/YY format uses
2 digits only. It already has happened twice this
month and will not happen again in 2020.
Now read my question carefully and provide
the
exact answer:
How many such “thrifty” dates exist in the period between 01/01/00 and 09/09/99 (both dates included) that less than 3 digits suffice to write them ?
To amplify the power of the moment try to post your comments close to 20:20 !
The same dates are thrifty regardless of the order of MM/DD/YY or DD/MM/YY or YY/MM/DD. The latter makes the most sense for an ordered presentation.
In order, here are the 158 dates that satisfy the criterion:
000101
000110
000111
000202
000220
000222
000303
000330
000404
000505
000606
000707
000808
000909
001001
001010
001011
001101
001110
001111
010101
010110
010111
011001
011010
011011
011101
011110
011111
020202
020220
020222
030303
030330
040404
050505
060606
070707
080808
090909
100101
100110
100111
101001
101010
101011
101101
101110
101111
110101
110110
110111
111001
111010
111011
111101
111110
111111
111112
111113
111114
111115
111116
111117
111118
111119
111121
111122
111211
111212
111221
111222
121111
121112
121121
121122
121211
121212
121221
121222
131111
131113
141111
141114
151111
151115
161111
161116
171111
171117
181111
181118
191111
191119
200202
200220
200222
211111
211112
211121
211122
211211
211212
211221
211222
220202
220220
220222
221111
221112
221121
221122
221211
221212
221221
221222
300303
300330
311111
311113
330303
330330
331111
331113
400404
411111
411114
440404
441111
441114
500505
511111
511115
550505
551111
551115
600606
611111
611116
660606
661111
661116
700707
711111
711117
770707
771111
771117
800808
811111
811118
880808
881111
881118
900909
911111
911119
990909
DefDbl A-Z
Dim crlf$, moLen As Variant
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
moLen = Array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
For ye = 0 To 99
For mo = 1 To 12
m$ = Right("00" + LTrim(RTrim(Str(mo))), 2)
For da = 1 To moLen(mo)
d$ = Right("00" + LTrim(RTrim(Str(da))), 2)
dt$ = Right("00" + LTrim(RTrim(Str(ye))), 2) + m + d
If dt <= "990909" And dt >= "000101" Then
used$ = "": good = 1
For i = 1 To 6
If InStr(used, Mid(dt, i, 1)) = 0 Then
used = used + Mid(dt, i, 1)
If Len(used) > 2 Then good = 0: Exit For
End If
Next
If good Then
ct = ct + 1
Text1.Text = Text1.Text & dt & crlf
End If
End If
Next
Next
Next ye
Text1.Text = Text1.Text & ct & " done"
DoEvents
End Sub
The program didn't have to consider February 29, as 0229 already has three differing digits. It did have to consider the lengths of the months, so as not to allow yymmdd = 311131, or any such that I hadn't thought of, if they exist.
|
Posted by Charlie
on 2020-02-22 14:13:08 |