I’ve asked my wife to select a certain date in a format MM/DD and she replied: 04/17 adding an unsolicited remark: …”and, mind you, it is my birthday and it is just around the corner…!
I tried the digits 0,1,4,7 as a candidate generator of all the dates in April i.e. 1 to 30 (in my head, of course) : 1, 1+0!, 4-1, 4, 4+1, 7-1, …7*4+1, 7*4+1+0! and (check whether I err) found out that her date allows to create all the dates of April.
Now - solve the following puzzle:
a. How many dates in a leap year can be considered “a perfect generator” for the month they represent, provided each of the four digits of MM/DD can be used once and any of the operators “+ - * / ^ and ! “ twice at most. Concatenation: only numbers.
b. What dates are the worst generators i.e. create the lowest quantity of dates?
c. What perfect generator has the lowest sum of digits in its MMDD?
d. What would be the answer to a. if a sqrt operator were allowed as well?
Brackets, of course, are allowed.
With square roots added, I limited the search to 9 levels deep (the maximum it turned out to be without square roots). To prevent the explosion of execution time, taking the square root was done by looking up in a list, where only perfect squares up to 25^2, and ratios of such perfect squares, were looked up. For other numbers, the square roots were not taken, thus avoiding calling the square root function, and helping to prune the tree of branches that would not lead to a solution.
0101 31 16
0102 31 23
0103 31 28
0104 31 28
0105 31 23
0106 31 22
0107 31 21
0108 31 21
0109 31 28
0110 31 16
0111 31 17
0112 31 26
0113 31 31
0114 31 31
0115 31 26
0116 31 25
0117 31 24
0118 31 25
0119 31 29
0120 31 23
0121 31 26
0122 31 27
0123 31 31
0124 31 30
0125 31 31
0126 31 31
0127 31 31
0128 31 30
0129 31 31
0130 31 28
0131 31 31
0201 29 22
0202 29 23
0203 29 29
0204 29 27
0205 29 26
0206 29 28
0207 29 28
0208 29 28
0209 29 29
0210 29 22
0211 29 24
0212 29 27
0213 29 29
0214 29 29
0215 29 29
0216 29 29
0217 29 29
0218 29 29
0219 29 29
0220 29 23
0221 29 27
0222 29 26
0223 29 29
0224 29 29
0225 29 29
0226 29 29
0227 29 29
0228 29 29
0229 29 29
0301 31 28
0302 31 31
0303 31 28
0304 31 30
0305 31 29
0306 31 29
0307 31 30
0308 31 31
0309 31 31
0310 31 28
0311 31 31
0312 31 31
0313 31 31
0314 31 31
0315 31 31
0316 31 31
0317 31 31
0318 31 31
0319 31 31
0320 31 31
0321 31 31
0322 31 31
0323 31 31
0324 31 31
0325 31 31
0326 31 31
0327 31 31
0328 31 31
0329 31 31
0330 31 28
0331 31 31
0401 30 28
0402 30 27
0403 30 29
0404 30 30
0405 30 30
0406 30 30
0407 30 29
0408 30 28
0409 30 30
0410 30 28
0411 30 30
0412 30 30
0413 30 30
0414 30 30
0415 30 30
0416 30 30
0417 30 30
0418 30 30
0419 30 30
0420 30 27
0421 30 30
0422 30 30
0423 30 30
0424 30 30
0425 30 30
0426 30 30
0427 30 30
0428 30 30
0429 30 30
0430 30 29
0501 31 23
0502 31 28
0503 31 29
0504 31 31
0505 31 25
0506 31 29
0507 31 27
0508 31 29
0509 31 30
0510 31 23
0511 31 26
0512 31 31
0513 31 31
0514 31 31
0515 31 31
0516 31 31
0517 31 30
0518 31 31
0519 31 31
0520 31 28
0521 31 31
0522 31 31
0523 31 31
0524 31 31
0525 31 31
0526 31 31
0527 31 31
0528 31 31
0529 31 31
0530 31 29
0531 31 31
0601 30 22
0602 30 29
0603 30 28
0604 30 30
0605 30 28
0606 30 19
0607 30 20
0608 30 21
0609 30 24
0610 30 22
0611 30 25
0612 30 30
0613 30 30
0614 30 30
0615 30 30
0616 30 29
0617 30 30
0618 30 28
0619 30 30
0620 30 29
0621 30 30
0622 30 30
0623 30 30
0624 30 30
0625 30 30
0626 30 30
0627 30 30
0628 30 30
0629 30 30
0630 30 28
0701 31 21
0702 31 28
0703 31 30
0704 31 30
0705 31 27
0706 31 20
0707 31 16
0708 31 22
0709 31 26
0710 31 21
0711 31 24
0712 31 31
0713 31 31
0714 31 31
0715 31 30
0716 31 31
0717 31 24
0718 31 29
0719 31 31
0720 31 28
0721 31 31
0722 31 31
0723 31 31
0724 31 31
0725 31 31
0726 31 31
0727 31 31
0728 31 31
0729 31 31
0730 31 30
0731 31 31
0801 31 21
0802 31 29
0803 31 31
0804 31 29
0805 31 29
0806 31 21
0807 31 22
0808 31 19
0809 31 26
0810 31 21
0811 31 25
0812 31 30
0813 31 31
0814 31 31
0815 31 31
0816 31 29
0817 31 29
0818 31 26
0819 31 30
0820 31 29
0821 31 30
0822 31 31
0823 31 31
0824 31 31
0825 31 31
0826 31 31
0827 31 31
0828 31 31
0829 31 31
0830 31 31
0831 31 31
0901 30 27
0902 30 30
0903 30 30
0904 30 30
0905 30 29
0906 30 24
0907 30 25
0908 30 26
0909 30 26
0910 30 27
0911 30 28
0912 30 30
0913 30 30
0914 30 30
0915 30 30
0916 30 30
0917 30 30
0918 30 29
0919 30 30
0920 30 30
0921 30 30
0922 30 30
0923 30 30
0924 30 30
0925 30 30
0926 30 30
0927 30 30
0928 30 30
0929 30 30
0930 30 30
1001 31 16
1002 31 23
1003 31 28
1004 31 28
1005 31 23
1006 31 22
1007 31 21
1008 31 21
1009 31 28
1010 31 16
1011 31 17
1012 31 26
1013 31 31
1014 31 31
1015 31 26
1016 31 25
1017 31 24
1018 31 25
1019 31 29
1020 31 23
1021 31 26
1022 31 27
1023 31 31
1024 31 30
1025 31 31
1026 31 31
1027 31 31
1028 31 30
1029 31 31
1030 31 28
1031 31 31
1101 30 17
1102 30 25
1103 30 30
1104 30 30
1105 30 26
1106 30 25
1107 30 24
1108 30 25
1109 30 28
1110 30 17
1111 30 13
1112 30 22
1113 30 26
1114 30 27
1115 30 24
1116 30 24
1117 30 24
1118 30 23
1119 30 27
1120 30 25
1121 30 22
1122 30 25
1123 30 30
1124 30 30
1125 30 30
1126 30 29
1127 30 29
1128 30 30
1129 30 30
1130 30 30
1201 31 26
1202 31 27
1203 31 31
1204 31 30
1205 31 31
1206 31 31
1207 31 31
1208 31 30
1209 31 31
1210 31 26
1211 31 22
1212 31 25
1213 31 31
1214 31 31
1215 31 31
1216 31 30
1217 31 30
1218 31 30
1219 31 31
1220 31 27
1221 31 25
1222 31 28
1223 31 31
1224 31 30
1225 31 31
1226 31 31
1227 31 31
1228 31 31
1229 31 31
1230 31 31
1231 31 31
The above included 186 perfect generators instead of 160:
0 0
0113 31 31
0114 31 31
0123 31 31
0125 31 31
0126 31 31
0127 31 31
0129 31 31
0131 31 31
1 8
0203 29 29
0209 29 29
0213 29 29
0214 29 29
0215 29 29
0216 29 29
0217 29 29
0218 29 29
0219 29 29
0223 29 29
0224 29 29
0225 29 29
0226 29 29
0227 29 29
0228 29 29
0229 29 29
2 16
0302 31 31
0308 31 31
0309 31 31
0311 31 31
0312 31 31
0313 31 31
0314 31 31
0315 31 31
0316 31 31
0317 31 31
0318 31 31
0319 31 31
0320 31 31
0321 31 31
0322 31 31
0323 31 31
0324 31 31
0325 31 31
0326 31 31
0327 31 31
0328 31 31
0329 31 31
0331 31 31
3 23
0404 30 30
0405 30 30
0406 30 30
0409 30 30
0411 30 30
0412 30 30
0413 30 30
0414 30 30
0415 30 30
0416 30 30
0417 30 30
0418 30 30
0419 30 30
0421 30 30
0422 30 30
0423 30 30
0424 30 30
0425 30 30
0426 30 30
0427 30 30
0428 30 30
0429 30 30
4 22
0504 31 31
0512 31 31
0513 31 31
0514 31 31
0515 31 31
0516 31 31
0518 31 31
0519 31 31
0521 31 31
0522 31 31
0523 31 31
0524 31 31
0525 31 31
0526 31 31
0527 31 31
0528 31 31
0529 31 31
0531 31 31
5 18
0604 30 30
0612 30 30
0613 30 30
0614 30 30
0615 30 30
0617 30 30
0619 30 30
0621 30 30
0622 30 30
0623 30 30
0624 30 30
0625 30 30
0626 30 30
0627 30 30
0628 30 30
0629 30 30
6 16
0712 31 31
0713 31 31
0714 31 31
0716 31 31
0719 31 31
0721 31 31
0722 31 31
0723 31 31
0724 31 31
0725 31 31
0726 31 31
0727 31 31
0728 31 31
0729 31 31
0731 31 31
7 15
0803 31 31
0813 31 31
0814 31 31
0815 31 31
0822 31 31
0823 31 31
0824 31 31
0825 31 31
0826 31 31
0827 31 31
0828 31 31
0829 31 31
0830 31 31
0831 31 31
8 14
0902 30 30
0903 30 30
0904 30 30
0912 30 30
0913 30 30
0914 30 30
0915 30 30
0916 30 30
0917 30 30
0919 30 30
0920 30 30
0921 30 30
0922 30 30
0923 30 30
0924 30 30
0925 30 30
0926 30 30
0927 30 30
0928 30 30
0929 30 30
0930 30 30
9 21
1013 31 31
1014 31 31
1023 31 31
1025 31 31
1026 31 31
1027 31 31
1029 31 31
1031 31 31
10 8
1103 30 30
1104 30 30
1123 30 30
1124 30 30
1125 30 30
1128 30 30
1129 30 30
1130 30 30
11 8
1203 31 31
1205 31 31
1206 31 31
1207 31 31
1209 31 31
1213 31 31
1214 31 31
1215 31 31
1219 31 31
1223 31 31
1225 31 31
1226 31 31
1227 31 31
1228 31 31
1229 31 31
1230 31 31
1231 31 31
12 17
186
worst dates(13):
1111
low sod:
0113
0131
0203
0302
0311
0320
1013
1031
1103
1130
so adding the square roots let 0909 increase from 13 to 26. Armistice Day (Veteran's Day) remains the worst generator.
The improved 0909 details are (square root represented by v):
1 0,!, 0!
2 0,!,0,!,+, 0!+0!
3 0,9,v,+, v9
4 0,!,9,v,+, 0!+v9
5 9,v,!,0,!,-, (v9)!-0!
6 9,v,!, (v9)!
7 0,!,9,v,!,+, 0!+(v9)!
8 9,0,!,-, 9-0!
9 9, 9
10 90,9,/, 90/9
11 0,!,90,9,/,+, 0!+90/9
12 9,9,v,+, 9+v9
13 0,!,9,9,v,+,+, 0!+9+v9
14 9,0,!,9,v,!,-,-, 9-(0!-(v9)!)
15 9,9,v,!,+, 9+(v9)!
16 0,!,9,9,v,!,+,+, 0!+9+(v9)!
17 9,0,!,9,-,-, 9-(0!-9)
18 9,9,+, 9+9
19 0,!,9,9,+,+, 0!+9+9
20
21 0,!,9,v,+,!,9,v,-, (0!+v9)!-v9
22
23
24 0,!,9,v,+,!, (0!+v9)!
25
26 9,9,v,*,0,!,-, 9*v9-0!
27 9,9,v,*, 9*v9
28 0,!,9,9,v,*,+, 0!+(9*v9)!
29 90,9,v,/,0,!,-, 90/v9-0!
30 90,9,v,/, 90/v9
0909 30 26
|
Posted by Charlie
on 2023-04-07 19:12:52 |