Overview of the NumberTheory Package - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Packages : NumberTheory

Overview of the NumberTheory Package

 

Calling Sequence

Description

List of NumberTheory Package Commands

Related Commands

Examples

Compatibility

Calling Sequence

NumberTheory[command](arguments)

command(arguments)

Description

• 

The NumberTheory package contains commands used to investigate the properties of the natural numbers and integers (see number theory).

• 

Each command in the NumberTheory package can be accessed by using either the long form or the short form of the command name in the calling sequence.

  

As the underlying implementation of the NumberTheory package is a module, it is also possible to use the form NumberTheory:-command to access a command from the package. For more information, see Module Members.

List of NumberTheory Package Commands

• 

The following is a list of commands in the NumberTheory package.

AreCoprime

test whether a sequence of numbers is relatively prime

CalkinWilfSequence

compute the nth term in the Calkin-Wilf sequence

CarmichaelLambda

Carmichael's lambda function

ChineseRemainder

generalized Chinese remainder algorithm

ContinuedFraction

continued fraction expansion

ContinuedFractionPolynomial

simple continued fraction expansions for real roots of a rational polynomial

CyclotomicPolynomial

minimal polynomials of primitive roots of unity with rational coefficients

Divisors

the set of positive divisors of an integer

FactorNormEuclidean

factorization of integers in quadratic norm-Euclidean fields

HomogeneousDiophantine

solution to Minkowski's linear forms

ImaginaryUnit

modular square root of -1

InhomogeneousDiophantine

inhomogeneous Diophantine approximation

IntegralBasis

integral base of an algebraic number field

InverseTotient

inverse of Euler's totient function

IsCyclotomicPolynomial

test whether a polynomial is cyclotomic

IsMersenne

test whether a number is a Mersenne number

IsSquareFree

test whether an integer is square free

IthFermat

Fermat numbers

IthMersenne

Mersenne exponents

JacobiSymbol

generalized Legendre symbol

KroneckerSymbol

generalized Jacobi symbol

Landau

compute the Landau g function

LargestNthPower

largest integer power divisor of a number

LegendreSymbol

quadratic residuosity

ModExtendedGCD

solutions to the modulo n extended GCD problem

ModularLog

discrete logarithm under modular arithmetics

ModularRoot

modular root

ModularSquareRoot

modular square root

Moebius

Möbius function

MultiplicativeOrder

order of a number under modular multiplication

NearestLatticePoint

solution to the nearby lattice point problem

NextSafePrime

least safe prime greater than a number

NumberOfIrreduciblePolynomials

number of monic irreducible polynomials

NumberOfPrimeFactors

number of prime factors counted with multiplicity

PrimeCounting

number of prime numbers less than a number

PrimeFactors

prime factors of an integer

PrimitiveRoot

primitive root modulo n

PseudoPrimitiveRoot

pseudo primitive root modulo n

QuadraticResidue

quadratic residuosity of a number

Radical

radical of an integer

RepeatingDecimal

rational number in repeating decimal form

RootsOfUnity

modular roots of unity

SimplestRational

compute the simplest rational number in a real interval

SumOfDivisors

sum of powers of the divisors

SumOfSquares

solutions to the sum of two squares problem

ThueSolve

solutions to a Thue equation or inequality

Totient

Euler's totient function

Related Commands

• 

The following commands are not in the NumberTheory package, but are closely related to number theory.

bernoulli

Bernoulli polynomials

chrem

Chinese Remainder Algorithm

doublefactorial

compute double factorial

euler

Euler polynomials

factorial

compute factorial

GaussInt[GIgcd]

greatest common divisor of Gaussian integers

ifactor

integer factorization

ifactors

integer factorization

igcd

greatest common divisor of integers

ilcm

least common multiple of integers

iroot

compute integer roots

isolve

solve Diophantine equations for integer solutions

isprime

primality test

isqrt

compute integer square roots

issqr

test for a perfect square

ithprime

determine the ith prime number

nextprime

determine the next largest prime

prevprime

determine the next smallest prime

surd

non-principal root function

Examples

withNumberTheory:

Show 37 as a repeated decimal:

RepeatingDecimal37

NumberTheory:-RepeatingDecimal37

(1)

Show 37 as a continued fraction:

ContinuedFraction37

NumberTheory:-ContinuedFraction37

(2)

 

Euler's totient (phi) function is an arithmetic function that counts the positive integers less than or equal to a given value, n, that are coprime to n. The PrimeCounting (or pi) command returns the number of primes less than an integer, n.

Comparing pi(n) with phi(n) for the first forty values for n:

plots:-displayDynamicSystems:-DiscretePlotseqi0.1,i=2..40,seqPrimeCountingn,n=2..40,style=stem,symbol=soliddiamond,color=Crimson,legend=pi,DynamicSystems:-DiscretePlotseqi+0.1,i=2..40,seqTotientn,n=2..40,style=stem,symbol=solidcircle,color=MidnightBlue,legend=Totient,linestyle=dot,transparency=0.1,size=800,400,axis2=gridlines=thickness=0,color=LightGrey

 

Two integers are relatively prime (coprime) if the greatest common divisor of the values is 1. The following plot shows the coprimes for the integers 1 to 25:

Statistics:-HeatMapMatrix25,i,j→`if`AreCoprimei,j,1,0,color=White,Pink

 

Compatibility

• 

The NumberTheory package was introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

Applications

Arithmetic Functions

Prime Numbers

Divisibility

Mersenne Primes

See Also

numtheory(deprecated)