Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

numlib::checkPrimalityCertificate

Test the primality certificate

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

numlib::checkPrimalityCertificate(certificate)

Description

numlib::checkPrimalityCertificate tests the certificate of primality returned by numlib::proveprime. For large prime numbers, the numlib::proveprime function generates certificates that provide all data you need for proving primality of a number by the Atkin-Goldwasser-Kilian-Morain algorithm. See Example 1.

For small prime numbers, numlib::proveprime does not return a certificate of primality. Instead, it returns TRUE. For nonprime numbers numlib::proveprime returns FALSE. In both cases, you do not need to use numlib::checkPrimalityCertificate.

Examples

Example 1

Use the numlib::proveprime function to check the primality of the number 1299709. The function returns the following sequence of lists. This sequence is the certificate of primality:

certificate := numlib::proveprime(1299709)

The certificate provides all data that you need for proving primality of 1299709 by the Atkin-Goldwasser-Kilian-Morain algorithm. You can substitute the numbers into the algorithm and verify the primality of the number. Alternatively, you can verify the certificate by using the numlib::checkPrimalityCertificate function:

numlib::checkPrimalityCertificate(certificate)

Parameters

certificate

A list or a sequence of lists returned by numlib::proveprime

Return Values

TRUE or FALSE

See Also

MuPAD Functions

More About

Was this topic helpful?