numlib::cornacchia

Cornachia's algorithm

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

numlib::cornacchia(a, b, m)

Description

numlib::cornacchia(a, b, m) returns all pairs of positive and relatively prime integers x, y that solve the equation ax2 + by2 = m.

The arguments a, b, m must be pairwise relatively prime.

Examples

Example 1

We compute the solutions to 3 x2 + 5 y2 = 74533332452454382449233:

numlib::cornacchia(3, 5, 74533332452454382449233)

Example 2

For non-prime m, there may be many solutions:

numlib::cornacchia(1, 4, 5*13*17*29*73)

Parameters

a

A positive integer

b

A positive integer

m

A positive integer

Return Values

numlib::cornacchia returns a set each element of which is a list of two positive integers.

See Also

MuPAD Functions

Was this topic helpful?