a^b for 2=<a=<100 and 2=<b=<100
No Solution Yet | Submitted by Ady TZIDON |
Rating: 5.0000 (1 votes) |
Less than 9801--computer assisted solution |
|
DATA 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
DATA 53,59,61,67,71,73,79,83,89,97
DIM prm(25), prmct(1, 25)
FOR i = 1 TO 25: READ prm(i): NEXT
OPEN "lt10000.txt" FOR OUTPUT AS #2
FOR a = 2 TO 100
a1 = a
FOR p = 1 TO 25
pr = prm(p)
prmct(0, p) = 0
WHILE a1 MOD pr = 0
a1 = a1 / pr
prmct(0, p) = prmct(0, p) + 1
WEND
NEXT p
FOR b = 2 TO 100
FOR p = 1 TO 25
prmct(1, p) = prmct(0, p) * b
PRINT #2, USING "####"; prmct(1, p);
NEXT p
PRINT #2,
NEXT b
NEXT a
CLOSE 2
creates a file with a record (line) for each of the 9801 results of a^b, each consisting of the result's number of times 2, 3, 5, 7, 11, ..., 97 appear as a factor of that result, including any that appear zero times. For example, the line for 45^5 appears as
0 10 5 0 0 0 ...
having 25 numbers, for the first 25 primes. Obviously most of these are zeros, as 45^5 = 3^10 * 5^5.
When the file was sorted and duplicate lines deleted, there were 9183 lines remaining, and that is the answer to the puzzle--the number of different values for a^b.
Alternatively, UBASIC could have been used to put the actual decimal representations of the results to a file and the same sorting and deletion done, as that language has the capability of handling numbers with 200 and even more digits. However, the above factoring into primes might be more conducive to inspiring an analytic solution. And it was more fun to do it this way in QB, getting around its limited precision.
Posted by Charlie on 2012-08-25 15:43:44 |