I have a program to code where it will solve a 5-1 fifth order Diophantine equation which is basically A^5 + B^5 + C^5 + D^5 + E^5 = F^5, where 0 < A <= B <= C <= D <= E <= F <= N. The way I am going to be implementing it is precomputing the values a given N value and then store it into an array. So for instance if N is 100, it will store the values between 1 to 100 in an array.
I will then compute the values of the first group, A^5 + B^5 + C^5, and the second group, F^5 - (D^5 + E^5), and compare the values from the first group to the second to see if they match. If it matches, then a solution is found.
My question is, how would I go about to compute all possible values of the two groups using the array of values between 1 to N? I have the idea down, but coding it out, I am not sure how to approach it. Can anyone please give me some hints? I am not asking for the solution as to how to code it, I just want some tips/hints which can help me understand the coding process a bit better. Thanks!
Better solution, first generate all 5th order values and store them in an array.
Then use 3 nested loops to generate every combination of F^5-E^5-D^5 store all these combinations
Then use 3 different nested loops to generate every combination of A^5+B^5+C^5 and store all these values.
Use 2 nested loops to compare the values of F^5-E^5-D^5 and A^5+B^5+C^5. if they are the same you have a solution. print the corresponding values of a,b,c,d,e and f.
we only use 2 pairs of 3 nested loops. this solution will be O(3nlogn) if not O(3n)