The top-level nextprime (or prevprime ) command returns the next (or previous) prime numbers after (or before) the given integer:
The Radical command returns the product of the prime divisors of an integer: The NumberOfPrimeFactors command returns the number of prime factors of an integer, counted with multiplicity: The PrimeFactors command returns a list of factors for a given integer that are primes without multiplicity: The top-level ifactor command gives the integer factorization of an integer: The SumOfDivisors command returns the sum of the divisors of an integer: If the divisors of a given integer are only 1 and itself, the number is prime.ġ, 2, 4, 7, 14, 28 The Divisors command can verify that a number is prime. The top-level isprime command determines if a given number is prime: For example, the first ten primes are given by the following sequence: The top-level ithprime command returns the i th prime.
While any command in the package can be referred to using the long form, for example, NumberTheory:-Divisors, it is often easier to load the package and then use the short form command names.Ī prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.