NumberTheory - Maple Programming Help

Home : Support : Online Help : Mathematics : Number Theory : NumberTheory/SumOfSquares

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

 > with(NumberTheory):
 > SumOfSquares(17);
 $\left\{\left[{1}{,}{4}\right]\right\}$ (1)
 > SumOfSquares(938491);
 ${\varnothing }$ (2)
 > s := SumOfSquares(10281960);
 ${s}{≔}\left\{\left[{234}{,}{3198}\right]{,}\left[{1014}{,}{3042}\right]{,}\left[{1422}{,}{2874}\right]{,}\left[{1446}{,}{2862}\right]{,}\left[{2106}{,}{2418}\right]\right\}$ (3)
 > map(ss -> ss[1]^2 + ss[2]^2, s);
 $\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.