Cornacchia's algorithm Created 2026-10-20 Updated 2026-11-05
Cornacchia's algorithm searches for primitive integer solutions of by combining a modular square root of modulo with the Euclidean algorithm. In the standard odd-prime case , choose a root with , run the Euclidean algorithm on until a remainder occurs, and test whether is a nonnegative integer square. Both roots can be tried.