Finding a number using optimization

I don’t know how exhaustive your search is going to be, but just as a result of the algebra, if a,b,c is a solution, so is na, nb, nc, where n is any integer.

yes am aware of that

To find x,y,z as positive integer where following equation is valid:
(1) x/y + y/z + z/x = R (R is real num)
(2) x^2/y + xy/z + z = Rx
(3) x^2/y + x*(y/z-R) + z = 0
we have to solve quadratic equation (3) (find x1,x2) for given y and z.
If we select any z and try to find all pairs {x,y} for which (1) is valid we can do it by iterating over y to find solution for x that satisfy quadratic equation (3)

For quadratic equation a* x^2 + b* x + c = 0 we have solutions:
(4) x1= -b/2a + Sqrt(D)/2a
x2= -b/2a - Sqrt(D)/2a
where D is discriminant of quadratic equation:
(5) D= b^2 – 4ac
It is obvious from (5) that quadratic equation has real solution if D>=0 and if D=0 it has only one solution, x1 = x2 = -b/2a.
Code for iterating over y for given z is in c# component. (6.9 KB)


You are awesome… Thank you very much for this.

So here a = 1/y and b = (y/z - R) and C = z and y iterates from 1 to n (value whatever we set for y max) and we find x value and it is substituted to quadratic equation to make it satisfy to zero … Is that right?

Correct. And you are looking just for solution where x, y and z are integeres.
For some combination of y and z you will have two soultion of your quadratic eqution.
Generaly, for example if eqution is:
x^2 - 16 = 0
it is obvious that solution is valid for two values of x, x1= -4 and x2= +4.
Quadratic equation may have none solution (solution is not in real numbers).
For example if quadratic equation is:
x^2 + 16 = 0
then solution is complex number x1= 4i and x2= -4i
( i is imaginary number, by definition i^2= -1, see )

1 Like

Thank you, Its like middle school all over again.