(35S) Pell's Equation Programme - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (35S) Pell's Equation Programme (/thread-1563.html) |
(35S) Pell's Equation Programme - Gerald H - 06-07-2014 09:17 AM The programme finds the primitive integer solution of Pell’s equation x^2 – D * y^2 = ± 1 for integer input D and 1 or -1 for solution of the +1 or -1 case respectively. Code: 1 LBL P For input 13 & 1 the programme returns [649, 180, 1] & indeed 649^2 – 13 * 180^2 = 1 Similarly input 13 & -1 returns [18, 5, -1] & 18^2 – 13 * 5^2 = -1 Input 7 & -1 returns 0, indicating that x^2 – 7 * y^2 = -1 has no integer solutions for x & y. |