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  (6)

Primes represents the domain of all prime numbers:

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:

Wolfram Research (2014), CompositeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/CompositeQ.html.

Text

Wolfram Research (2014), CompositeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/CompositeQ.html.

CMS

Wolfram Language. 2014. "CompositeQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CompositeQ.html.

APA

Wolfram Language. (2014). CompositeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CompositeQ.html

BibTeX

@misc{reference.wolfram_2023_compositeq, author="Wolfram Research", title="{CompositeQ}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/CompositeQ.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_compositeq, organization={Wolfram Research}, title={CompositeQ}, year={2014}, url={https://reference.wolfram.com/language/ref/CompositeQ.html}, note=[Accessed: 19-March-2024 ]}