In computational number theory, Cornacchia's algorithm is an algorithm for solving the Diophantine equation x 2 + d y 2 = m {\displaystyle x^{2}+dy^{2}=m} , where 1 ≤ d < m {\displaystyle 1\leq d<m} and d and m are coprime. The algorithm was described in 1908 by Giuseppe Cornacchia.[1]