Sum of Squares - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

NumberTheory

 SumOfSquares
 solutions to the sum of two squares problem

 Calling Sequence SumOfSquares(n)

Parameters

 n - integer

Description

 • The SumOfSquares function computes the solutions to the sum of two squares problem.
 • The return value is a set $s$ of two-element lists of non-negative integers such that $\left[x,y\right]$ is in $s$ if and only if $x\le y$ and ${x}^{2}+{y}^{2}=n$.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\mathrm{SumOfSquares}\left(17\right)$
 $\left\{\left[{1}{,}{4}\right]\right\}$ (1)
 > $\mathrm{SumOfSquares}\left(938491\right)$
 ${\varnothing }$ (2)
 > $s≔\mathrm{SumOfSquares}\left(10281960\right)$
 ${s}{≔}\left\{\left[{234}{,}{3198}\right]{,}\left[{1014}{,}{3042}\right]{,}\left[{1422}{,}{2874}\right]{,}\left[{1446}{,}{2862}\right]{,}\left[{2106}{,}{2418}\right]\right\}$ (3)
 > $\mathrm{map}\left(\mathrm{ss}↦{\mathrm{ss}\left[1\right]}^{2}+{\mathrm{ss}\left[2\right]}^{2},s\right)$
 $\left\{{10281960}\right\}$ (4)

Compatibility

 • The NumberTheory[SumOfSquares] command was introduced in Maple 2016.
 • For more information on Maple 2016 changes, see Updates in Maple 2016.