Ask Your Question
0

Finding all integer solutions of binary quadratic form

asked 2024-02-20 16:53:10 +0200

imbluedabedee gravatar image

updated 2024-02-20 16:53:46 +0200

I found the following page to calculate one solution for a binary quadratic form $ax^2+bxy +cy^2$: Link

Is there an algorithm to find, if possible, all integer solutions?

edit retag flag offensive close merge delete

Comments

Here you might find some functions that might be of interest for you (and, among other things, also encapsulate pari's qfbsolve): BQForms

Peter Luschny gravatar imagePeter Luschny ( 2024-02-20 22:00:39 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2024-02-20 18:24:28 +0200

Max Alekseyev gravatar image

updated 2024-02-20 18:47:59 +0200

You can call pari.qfbsolve directly with flag set to 1 or 3. Rephrasing examples from the PARI/GP manual:

sage: pari.qfbsolve(pari.Qfb(1,0,2), 603, 1).sage()       # all primitive solutions
[[5, 17], [-19, -11], [19, -11], [5, -17]]

sage: pari.qfbsolve(pari.Qfb(1,0,2), 603, 3).sage()       # all solutions
[[5, 17], [-19, -11], [19, -11], [5, -17], [-21, 9], [-21, -9]]
edit flag offensive delete link more

Comments

Thanks a lot to you and Peter for your helpful comments!

imbluedabedee gravatar imageimbluedabedee ( 2024-02-22 17:37:09 +0200 )edit
0

answered 2024-05-04 09:27:32 +0200

Peter Luschny gravatar image

Some years ago, on a blog on the OEIS, I implemented various algorithms with a simple common interface in Sage, written in Python2.

Your question prompted me to update the code to Python3 and make it available on GitHub. It also describes how to experiment with it on the Sage Cell Server.

Specifying the three coefficients (a, b, c) and the desired restriction, one of {all, primitively, prime}, not only returns the representatives but also points to the sequence in the OEIS (if it is registered there).

https://github.com/PeterLuschny/Binar...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-02-20 16:53:10 +0200

Seen: 179 times

Last updated: May 04