The Kornachchi algorithm is an algorithm for solving the Diophantine equation where , and d and m are coprime . The algorithm was described in 1908 by Giuseppe Cornachchi [1] .
Content
Algorithm
First we find any solution . If such does not exist, the original equation has no primitive solutions. Without loss of generality, we can assume that (if this is not so, replace r 0 with m - r 0 , which remains the root of - d ). Now we use the Euclidean algorithm to search , and so on. Stop when . If a is an integer, then the solution will be . Otherwise, there is no primitive solution.
To search for non-primitive solutions ( x , y ), where GCD ( x , y ) = g ≠ 1, we note from the existence of such a solution that g 2 divides m (and, equivalently, if m is square-free , then all solutions are primitive). Then the above algorithm can be used to search for a primitive solution ( u , v ) of the equation . If such a solution is found, then ( gu , gv ) will be a solution to the original equation.
Example
We solve the equation . The square root of −6 (mod 103) is 32 and 103 ≡ 7 (mod 32). Insofar as and , there exists a solution x = 7, y = 3.
Notes
- ↑ Cornacchia, 1908 , p. 33–90.
Literature
- G. Cornacchia. Su di un metodo per la risoluzione in numeri interi dell 'equazione . // Giornale di Matematiche di Battaglini. - 1908. - T. 46 .
Links
Basilla, Julius Magalona On Cornacchia's algorithm for solving the diophantine equation (PDF) (12 May 2004).