mersenneforum.org Pell's equation
 Register FAQ Search Today's Posts Mark Forums Read

2022-10-26, 17:59   #1
Jombo G

Aug 2019

2×3 Posts
Pell's equation

Hey there!

Attached is a Pell's equation solver program, in Pari-GP

It uses very basic operations but seems to be quick enough.
Warning though, if Y^2 - N*X^2 does not go to 1 quickly, the numbers tend to become
quite prohibitively large. Nothing wrong with that perhaps, but before (and/or if) you run
it in Pari, please set the precision to 200-odd digits using the command:

\p 200

in the terminal window. At least this gives it a good chance of finding answers for larger

values of N - though obviously even (relatively) small N values can still have large-ish smallest

solutions, if you see what I mean?!!

PS: The code is a bit of a mess atm, with not all variables being used etc. I'll clean it up when I get the time.
Cheers.
Attached Files
 Pells Equation Solver_.txt (1.6 KB, 22 views)

2022-10-26, 20:11   #2
sweety439

"99(4^34019)99 palind"
Nov 2016
(P^81993)SZ base 36

2×7×263 Posts

Quote:
 Originally Posted by Jombo G Attached is a Pell's equation solver program, in Pari-GP
Well, I have a data, for the smallest solution of x^2-d*y^2 = 0, +-1, +-2, +-3, +-4 (if exists, the +-4 case only list primitive solutions, i.e. not a double of the x and y for the +-1 case), for d <= 25000
Attached Files
 pell solutions for d le 25000.zip (1.02 MB, 50 views)

Last fiddled with by Uncwilly on 2022-10-27 at 00:14 Reason: Removing a vast and unneeded quote

 2022-10-26, 20:19 #3 R. Gerbicz     "Robert Gerbicz" Oct 2005 Hungary 32×179 Posts That is too slow, there is a pretty nice stuff for Pell equation: http://library.msri.org/books/Book44.../01lenstra.pdf See section 7, that is really working, I've coded that, not public.
 2022-10-26, 21:29 #4 Jombo G   Aug 2019 2·3 Posts Thanks very much. I was looking for a resource like this to test against online. I have a Pell's Equation book, but it only has a few results in it.
 2022-10-28, 03:13 #5 sweety439   "99(4^34019)99 palind" Nov 2016 (P^81993)SZ base 36 2×7×263 Posts PARI/GP code for Pell equation: http://www.kaynet.or.jp/~kay/misc/program/pell.gp Many other computer program codes for Pell equation: https://rosettagit.org/drafts/pells-equation/ Data for solutions of Pell equations: http://www.kaynet.or.jp/~kay/misc/pell2.html and https://raw.githubusercontent.com/xa...20equation.txt and https://raw.githubusercontent.com/xa...le%2025000.txt Online Pell equation solvers: 1. http://www.jakebakermaths.org.uk/mat...ntegerv10.html 2. http://math.fau.edu/richman/pell-m.htm 3. http://www.numbertheory.org/php/pell.html

 Similar Threads Thread Thread Starter Forum Replies Last Post enzocreti enzocreti 6 2020-03-23 03:03 Till Abstract Algebra & Algebraic Number Theory 13 2017-01-20 21:12 jwaltos Miscellaneous Math 0 2015-08-29 02:13 T.Rex Math 0 2005-03-29 21:16 koal Puzzles 3 2003-07-03 11:58

All times are UTC. The time now is 16:36.

Sat Feb 4 16:36:47 UTC 2023 up 170 days, 14:05, 1 user, load averages: 0.51, 0.78, 0.82