Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

Finding all integer solutions of binary quadratic form

asked 0 years ago

imbluedabedee gravatar image

updated 0 years ago

I found the following page to calculate one solution for a binary quadratic form ax2+bxy+cy2: Link

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

Preview: (hide)

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 ( 0 years ago )

2 Answers

Sort by » oldest newest most voted
1

answered 0 years ago

Max Alekseyev gravatar image

updated 0 years ago

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]]
Preview: (hide)
link

Comments

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

imbluedabedee gravatar imageimbluedabedee ( 0 years ago )
0

answered 0 years ago

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...

Preview: (hide)
link

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: 0 years ago

Seen: 298 times

Last updated: May 04 '24