Find the total number of 8-digit positive integers (each containing no zeros) such that the product of four leftmost digits is equal to 6 times the product of the four rightmost digits.
There are 225 possible products of four non-zero digits. They are shown here with the ways the digits can be arranged to produce the given product; for example, the 10 ways of producing 4 are the four positions the 4 can have among three 1's plus the 10 ways of permuting two 2's and two 1's.
1 1
2 4
3 4
4 10
5 4
6 16
7 4
8 20
9 10
10 12
12 36
14 12
15 12
16 31
18 36
20 24
21 12
24 64
25 6
27 16
28 24
30 36
32 40
35 12
36 72
40 40
42 36
45 24
48 88
49 6
50 12
54 52
56 40
60 60
63 24
64 44
70 24
72 112
75 12
80 48
81 19
84 60
90 60
96 96
98 12
100 18
105 24
108 88
112 48
120 84
125 4
126 60
128 40
135 28
140 36
144 132
147 12
150 24
160 48
162 52
168 84
175 12
180 84
189 28
192 88
196 18
200 24
210 48
216 116
224 48
225 18
240 84
243 16
245 12
250 4
252 84
256 31
270 60
280 48
288 120
294 24
300 24
315 36
320 40
324 72
336 84
343 4
350 12
360 96
375 4
378 60
384 64
392 24
400 18
405 24
420 48
432 112
441 18
448 40
450 24
480 60
486 36
490 12
500 4
504 96
512 20
525 12
540 60
560 36
567 24
576 88
588 24
600 24
625 1
630 48
640 24
648 76
672 60
675 12
686 4
700 12
720 72
729 10
735 12
750 4
756 60
768 36
784 18
800 12
810 36
840 48
864 76
875 4
882 24
896 24
900 18
945 24
960 36
972 36
980 12
1000 4
1008 72
1024 10
1029 4
1050 12
1080 52
1120 24
1125 4
1134 36
1152 48
1176 24
1200 12
1215 12
1225 6
1260 36
1280 12
1296 55
1323 12
1344 36
1350 12
1372 4
1400 12
1440 36
1458 16
1470 12
1512 52
1536 16
1568 12
1575 12
1600 6
1620 24
1680 24
1701 12
1715 4
1728 40
1764 18
1792 12
1800 12
1890 24
1920 12
1944 28
1960 12
2016 36
2025 6
2048 4
2058 4
2160 24
2187 4
2205 12
2240 12
2268 24
2304 18
2352 12
2401 1
2430 12
2520 24
2560 4
2592 24
2646 12
2688 12
2744 4
2835 12
2880 12
2916 10
3024 24
3072 4
3087 4
3136 6
3240 12
3402 12
3456 12
3528 12
3584 4
3645 4
3888 12
3969 6
4032 12
4096 1
4374 4
4536 12
4608 4
5103 4
5184 6
5832 4
6561 1
Then, the ways of each is multiplied by the ways of 6 times that value, if that exists:
1*16 + 4*36 + 4*36 + 10*64 + ...
The grand total is 225896.
DefDbl A-Z
Dim crlf$, nlzero(6561)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
For a = 1 To 9
For b = 1 To 9
For c = 1 To 9
For d = 1 To 9
t = a * b * c * d
nlzero(t) = nlzero(t) + 1
If nlzero(t) = 1 Then dct = dct + 1
Next
Next
Next
Next
Text1.Text = dct & crlf
For i = 0 To 6561
If nlzero(i) > 0 Then
Text1.Text = Text1.Text & mform(i, "###0")
Text1.Text = Text1.Text & mform(nlzero(i), "###0") & crlf
End If
Next
Text1.Text = Text1.Text & crlf
For low = 1 To 6561 / 6
totnumber = totnumber + nlzero(low) * nlzero(6 * low)
Next
Text1.Text = Text1.Text & totnumber & crlf & " done"
End Sub
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
|
Posted by Charlie
on 2015-10-07 20:02:02 |