Consider the following formula:
ABCDE
+BCDE
+ CDE
+ DE
+ E
-----
FGHIJ
Where each letter represents a unique decimal digit, and there are no leading zeroes for any number in the formula.
If
A
+
B
+
C
+
D
+
E
is minimal, what is the number
A
B
C
D
E
F
G
H
I
J
?
(The string of digits, not the product.)
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
bantog ra. tikasan man diay
1 2 3 4 5 6 7 8 9 10 11 |
|
It's run in 0.443909168243 seconds.
I used Python coding. Note that A , B , C , D and E are = 0 . The results should that A + B + C + D + E = 2 1 is minimum and the answer is 3 8 1 7 2 4 6 5 9 0 .
for a in range(1,10): for b in range(10): if b==a: continue for c in range(1,10): if c==a or c==b: continue for d in range(1,10): if d==a or d==b or d==c: continue for e in range(1,10): if e==a or e==b or e==c or e==d: continue n1 = 10000*a+1000*b+100*c+10*d+e n2 = 10000*a+2000*b+300*c+40*d+5*e s = str(n1)+str(n2) if len(s) < 11: OK = "Y" for i in range(9): for j in range(i+1,10): if s [i]==s[j]: OK = "N" if OK == "Y": print a+b+c+d+e, s
27 1476920385
23 1487320695
24 2489130765
21 3817246590
23 6493170825
27 6539471280
28 8675294310
27 8742695310
Runs in two seconds on my 2 cores old computer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
There are 14 solutions to the equation:
1 0 0 0 0 A + 2 0 0 0 B + 3 0 0 C + 4 0 D + 5 E = 1 0 0 0 0 F + 1 0 0 0 G + 1 0 0 H + 1 0 I + J
Subject to the restriction:
{ A , B , C , D , E , F , G , H , I , J } = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 }
6 of these don't count, because they yield leading zeroes in the addends. This yields the remaining 8 solutions:
(1, 4, 7, 6, 9, 2, 0, 3, 8, 5)
(1, 4, 8, 7, 3, 2, 0, 6, 9, 5)
(2, 4, 8, 9, 1, 3, 0, 7, 6, 5)
(3, 8, 1, 7, 2, 4, 6, 5, 9, 0)
(6, 4, 9, 3, 1, 7, 0, 8, 2, 5)
(6, 5, 3, 9, 4, 7, 1, 2, 8, 0)
(8, 6, 7, 5, 2, 9, 4, 3, 1, 0)
(8, 7, 4, 2, 6, 9, 5, 3, 1, 0)
Of these, the unique, minimal value of A + B + C + D + E is 2 1 :
3 + 8 + 1 + 7 + 2 = 2 1
This yields the formula:
38172
+8172
+ 172
+ 72
+ 2
-----
46590
And the solution is thus 3 8 1 7 2 4 6 5 9 0 .
Here's some naive python code. It takes about a minute to run through 1 0 ! permutations on my machine - faster runtimes can be achieved by observing that:
Probably more as well.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
How did you find the solutions? It seems to be somewhat tedious listing / case checking.
Log in to reply
Loops.
Bah, you're right, this was a poor problem to post. I was optimistic that there might have been a cleverer way to discover these answers, but there doesn't seem to be in retrospect. I'll delete the problem in a bit, come up with something better.
Log in to reply
This is a valid question. and there is no reason to delete it. I was asking because it might be better placed in Computer Science.
I get that J = 0 or 5, but after that it wasn't clear how to proceed.
Log in to reply
@Calvin Lin – Is it possible to re-categorize it without deleting and reposting it? I've yet to discover such an option in the UI
Log in to reply
@Daniel Ploch – I have (just) taken care of it. Thanks!
Log in to reply
@Calvin Lin – Alright, thanks! Sorry for the trouble.
I do not think you can assume B >= 5 based just on observation. Note 4 + 4 + 2 (carried) = 10 which will carry 1 to A.
So if C = 9, 9 + 9 + 9 = 27, so H = 7, B = 4, G = 0
B = 4, G = 0, C = 7, H = 1 also works.
Quite repulsive in comparison to others.
Here's my C++ code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
java code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
output:
[27, 23, 24, 21, 23, 27, 28, 27]
[1476920385, 1487320695, 2489130765, 3817246590, 6493170825, 6539471280, 8675294310, 8742695310]
8
Press any key to continue . . .
I solved this by trial and error (old-fashioned way). It took me 5 tries to get
38172+8172+172+72+2 = 46590
Problem Loading...
Note Loading...
Set Loading...
Some Lazy python code,takes less than a second on my machine.