I am working on a problem in Number Theory which requires that I solve a rather complicated Diophantine equation. Let's call this equation f(r1, r2, ..., rk). The number of variables in the equation is itself variable. This is where I am getting tripped up on the programming.
I wish to write a java method whose signature would look like this :
int[] getExponents( int n, int k, int max );
Here, the argument k is equal to the number of arguments in our Diophantine equation f(r1, ... , rk).
This method should evaluate f(r1, ... , rk) for all combinations of r1, ..., rk such that 0 < r1 < r2 < ... < rk < max, where max is the agrument given in our method signature.
If we find r 's such that n = f(r1, ... , rk) then we wish to return the r1, ... , rk as an integer array. (The value n is given in our method signature.)
I suspect that this method will use recursion. Unfortunately, either my programming skills or my patience are not strong enough to find it.
I would be grateful to anyone able to outline such a method for me.