2

I've seen a few posts asking about the same form but for prime number $p$. I want to know how this can be extended to a general integer $n$. This property is certainly not exclusive to primes since $6= 2^2 + 2 \times 1^2$.

I’m not sure if prime decomposition would help because we would need to multiply with the remaining primes and that would mess up the form.

I can sense a slight relation to Fermat’s theorem on how $p=x^2 +y^2$ iff $p \equiv 1 \pmod 4$ but again this works for primes.

Any help would be much appreciated.

Parcly Taxel
  • 105,904
Meow
  • 155
  • 7

1 Answers1

4

Kenneth Hardy, Joseph B. Muskat and Kenneth S. Williams. "A Deterministic Algorithm for Solving $n = fu^2 + gv^2$ in coprime integers $u,v$". Mathematics of Computation, Vol 55, No.191. July 1990, pp. 327-343. url (accessed Oct 5, 2022): https://people.math.carleton.ca/~williams/papers/pdf/165.pdf

This paper describes a method to write $n$ in the form $n = fu^2 + gv^2$. It requires factoring $n$.

One may also use Cornacchia's algorithm to solve $x^2 + dy^2 = m$ where $d, m$ are coprime. See: https://en.wikipedia.org/wiki/Cornacchia%27s_algorithm

As mentioned in comments below, this provides methods for representing a specific $n$ in the form.

The existence of a representation in the form derives from the Brahmagupta Identity:

$$ \begin{align} N & = (a^2+nb^2 )(c^2+nd^2 ) \\ & = (ac-nbd)^2+n(ad+bc)^2 \\ & = (ac+nbd)^2+n(ad-bc)^2 \\ \end{align} $$

i.e., $N$ is represented in the form if and only if the cofactors are reperesented in the same form.

vvg
  • 3,526
  • 1
    This reference does not characterize all $n$ of a certain form, but rather presents a method to find a representation for a fixed $n$. – WimC Oct 05 '22 at 05:51