
Note that if you count how many times each prime appears in the list, x^n will always have the same proportions as x, for instance 6^n will have an equal quantity of 2's and 3's.

Raising a number to an integer power means multiplying it by itself so, represented as a list of primes, this is equivalent to simply concatenating the lists. His basic algorithm here is to figure out how many duplicates are present, and subtract that value from the maximum.Īs for counting duplicates, it might help intuitively to think of the numbers in terms of their prime factors. There are 99 possible numbers, so the number of combinations is 99 * 99, with possible duplicates. Well, the question involves ways to combine two numbers chosen from a range. And it misses some pairs of rows entirely (you never have i=9 and j=27, or i=27 and j=81). But again, unless I'm missing something, the program seems hopelessly imprecise. The C++ program you found is trying to count them by visiting each pair of overlapping rows i and j, and calculating how much of row i overlaps row j.

I've marked two places where there are duplicates. Here is a picture of that simpler problem, for x=3 and b ranging only from 2 to 10. So to find all duplicates for any given x, you only need to find duplicates for the simpler expression eb where 2 ≤ x e ≤ 100 and 2 ≤ b ≤ 100. So we have established that for all duplicates, a 1 = x e 1 and a 2 = x e 2 for some integers x, e 1, and e 1.


I have read that some players like to produce approximate answers and then dictionary-attack the Project Euler servers to brute-force the problem. Prime.I may be missing something, but it seems to me this program gives the wrong answer.
