Solve this alphametic, where each of the capital letters in bold denotes a different decimal digit from 0 to 9. None of the numbers can contain any leading zero.
3√(HOW)+ 3√(AND) = 3√(WHEN)
(In reply to
re: two views by Charlie)
to arrive at the solution I used a more generalized form of the problem which is finding integers x>y and z such that x^(1/3)+y^(1/3)=z^(1/3). I used the following code
10 for x=3 to 1000
20 for y=2 to x-1
30 z=int((x^(1/3)+y^(1/3))^3)
40 if x^(1/3)+y^(1/3)=z^(1/3) and int(x^(1/3))^3<>x and int(y^(1/3))^3<>y then
50 :print x;y;z
60 next y
70 next x
this produces the sole solution x=375 y=192 z=2187
which fits as a solution to the alphametic. This approach lead to my observation that this is acutally the first solution to the more generalized form stated above and if you change line 10 to search for values of x,y above 1000 you will find the other solutions that I previously listed. I found this interesting because initially going into this problem I thought there would be much smaller (i.e single digit) values of x,y that gave an integer value for z.
Also the precision problems that you were incountering are most likely avoided by UBASIC because it natively uses extremely high precision arithmatic.
|
Posted by Daniel
on 2009-07-30 20:29:21 |