Main Content

Number Theory

Modular arithmetic operations and sequences of numbers

You can perform elementary number-theoretic operations to find the LCM, GCD, modulus, quotient, and remainder. You also can find prime numbers, and special sequences of numbers, such as harmonic, Bernoulli, and Euler numbers.

Functions

expand all

divisorsDivisors of integer or expression
factorIntegerPowerPerfect power factoring
gcdGCD of numbers and polynomials
isPrimitiveRootDetermine which array elements are primitive roots (Since R2020a)
lcmLeast common multiple
maxMaximum elements of symbolic input (Since R2021a)
minMinimum elements of symbolic input (Since R2021a)
modSymbolic modulus after division
powermodModular exponentiation
quoremQuotient and remainder
remRemainder after division
bernoulliBernoulli numbers and polynomials
eulerEuler numbers and polynomials
fibonacciFibonacci numbers
harmonicHarmonic function (harmonic number)
ratRational fraction approximation (continued fraction) (Since R2020a)
nextprimeNext prime number
nthprimenth prime number
prevprimePrevious prime number
eulerPhiEuler phi function (Since R2020a)
jacobiSymbolJacobi symbol (Since R2020a)