My house's number can be written
as ABCD but it also equals to
A^B * C^D.
Find the number ..-no computer programs!!!
A and C can't be zero.
<o:p> </o:p>
The possible powers (A ^ B) and (C ^D) are :
<o:p> </o:p>
Powers of 2 : 1, 2, 4, 8, 16, 32, 64, 128, 256 and 512.<o:p></o:p>
Powers of 3 : 1, 3, 9, 27, 81, 243, 729, 2187 and 6561.<o:p></o:p>
Powers of 4 : 1, 4, 16, 64, 256, 1024 and 4096.<o:p></o:p>
Powers of 5 : 1, 5, 25, 125, 625 and 3125.<o:p></o:p>
Powers of 6 : 1, 6, 36, 216, 1296 and 7776.<o:p></o:p>
Powers of 7 : 1, 7, 49, 343 and 2401.<o:p></o:p>
Powers of 8 : 1, 8, 64, 512 and 4096.<o:p></o:p>
Powers of 9 : 1, 9, 81, 729 and 6561.<o:p></o:p>
<o:p> </o:p>
Ordering, the possible values of (A^B) and (C^D) are :<o:p></o:p>
<o:p> </o:p>
1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 125, 128, 216, 243, 256, 343, 512, 625, 729, 1024, 1296, 2187, 2401, 3125, 4096, 6561 and 7776.
There are 34 possibilities, but there is no need to cross (product) them two by two, because we know that my house's number vary from <st1:metricconverter w:st="on" ProductID="1000 a">1000 to</st1:metricconverter> 9999.<o:p></o:p>
<o:p> </o:p>
The search can be significantly reduced analyzing in this way :<o:p></o:p>
<o:p> </o:p>
Let's take, for example, the power “<st1:metricconverter w:st="on" ProductID="8”">8”</st1:metricconverter> (wich can be 2^3 or 8^1). Since the product vary from <st1:metricconverter w:st="on" ProductID="1000 a">1000 to</st1:metricconverter> 9999, we can restrict ourselves to multiply “<st1:metricconverter w:st="on" ProductID="8”">8”</st1:metricconverter> to those powers greaters or equal to 125 and less or equal to 1014. But, we can limit more our search : a) for (A ^ B) = (2 ^ 3), we need only verify if there is any product that starts with 23. In seconds, none. For (C ^ D) = (2 ^3), there is no product to make since no product by 8 will finish in "3" (of "23"); b) for (A ^ B) = (8^1), we verify if exists any product that starts with 81. In seconds, none !. And for (C ^ D) = (8 ^ 1), no product need to be made, since there is no product by 8 that ends in "1" (of "81").<o:p></o:p>
<o:p> </o:p>
Eliminating using this method, we restrict ourselves to a very few products, and in few minutes we found the solution : 2592, wich is (2 ^ 5) * (9 ^ 2) = 32 x 81.
NO PROGRAMMING !!!!
<o:p></o:p>
|
Posted by ARLEKIM
on 2005-02-06 22:39:21 |