CompositeQ

CompositeQ[n]

yields True if n is a composite number, and yields False otherwise.

Details and Options

  • CompositeQ is typically used to test whether an integer is a composite number.
  • A composite number is a positive number that is the product of two integers other than 1.
  • CompositeQ[n] returns False unless n is manifestly a composite number.
  • For negative integer n, CompositeQ[n] is effectively equivalent to CompositeQ[-n].
  • With the setting GaussianIntegers->True, CompositeQ determines whether a number is a composite number over Gaussian integers.
  • CompositeQ[m+In] automatically works over Gaussian integers.

Examples

open allclose all

Basic Examples  (2)

Test whether a number is composite:

The number is not composite:

Scope  (4)

CompositeQ works over integers:

Gaussian integers:

Test for large integers:

CompositeQ threads over lists:

Options  (1)

GaussianIntegers  (1)

Test whether is composite over integers:

Gaussian integers:

Applications  (9)

Basic Applications  (3)

Highlight composite numbers:

Generate the composite number:

Generate random composite numbers:

The distribution of Gaussian composite numbers:

Number Theory  (6)

Recognize Sierpiński numbers k where is always composite:

Recognize powerful numbers n whose prime factors are all repeated:

All perfect powers are powerful numbers:

Recognize base b pseudoprimes, composite numbers n such that :

Find all base pseudoprimes below :

Find all base pseudoprimes below :

Find large composite numbers of the form :

The distribution of composite numbers over integers:

Plot the distribution:

The distribution of composite numbers over the Gaussian integers:

Plot the distribution:

Properties & Relations  (5)

Primes represents the domain of all prime numbers:

No composite number belongs to Primes:

PrimeQ gives False for all composite numbers:

CompositeQ gives False for all primes:

Composite numbers cannot be a MersennePrimeExponent:

Composite numbers have at least two prime factors including multiplicities:

Composite numbers that are the power of a prime number have exactly divisors:

Neat Examples  (2)

Plot composite numbers that are the sum of three squares:

Plot the Ulam spiral where numbers are colored based on their compositeness:

Introduced in 2014
 (10.0)