(12C) Pell's Equation
|
07-07-2018, 11:24 AM
(This post was last modified: 07-07-2018 11:35 AM by Dieter.)
Post: #3
|
|||
|
|||
RE: (12C) Pell's Equation
(07-07-2018 05:16 AM)Gamo Wrote: I personally make a note on this subject found on this MoHPC old forum and don't remember who posted this in the forum. The program you posted was written by Gerson W. Barbosa, it can be found in the old forum as linked in Thomas' post. The limitations of a 10-digit calculator have already been mentioned. This means that results with 6 digits or more may and will produce roundoff errors when x² or y² is calculated. And checking whether Pell's equation evaluates to 1 or not will fail. Which doesn't mean there is no way – consider the posts by Egan Ford in the mentioned old forum thread. Having said that, here's my attempt. A bit shorter and with less registers. ;-) Code: 01 STO 0 This returns the first solution of the equation (at least if the trivial solution x=1 and y=0 is ingored). Example: n=92 Code: f PRGM But there are infinitely many more solutions. These can be obtained with the recurrence formula as shown in the Wikipedia article. Replace the last three steps in the program above with this: Code: ... Example: n=7 Code: f PRGM Please note that there is no solution if n is the square of an integer. In this case the program will throw an error: 25 [R/S] => Error 0. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(12C) Pell's Equation - Gamo - 07-07-2018, 05:16 AM
RE: (12C) Pell's Equation - Thomas Klemm - 07-07-2018, 09:29 AM
RE: (12C) Pell's Equation - Dieter - 07-07-2018 11:24 AM
RE: (12C) Pell's Equation - Gamo - 07-08-2018, 10:51 AM
RE: (12C) Pell's Equation - SlideRule - 07-11-2018, 02:49 PM
|
User(s) browsing this thread: 1 Guest(s)