User Rating 0.0
Total Usage 0 times
Presets:
0%
Is this tool helpful?

Your feedback helps us improve.

About

A composite number is any integer n > 1 that is not prime. It has at least one positive divisor other than 1 and itself. The smallest composite is 4 (2 × 2). Misidentifying composites causes failures in cryptographic key generation, hash table sizing, and modular arithmetic routines. This tool enumerates composites using trial division up to n, which is sufficient and exact for the ranges supported here (up to 10,000,000). It does not use probabilistic tests. Every result is deterministic.

Two modes are provided: generate the first k composite numbers starting from any integer, or enumerate all composites within a closed interval [a, b]. Note: 1 is neither prime nor composite by convention (OEIS A002808). The sequence density increases with magnitude. Approximately n nln(n) integers below n are composite, so large ranges produce substantial output.

composite numbers number generator non-prime numbers number sequence composite sequence math generator integer sequence

Formulas

A number n is composite if and only if it satisfies both conditions:

n > 1 and d {2, 3, …, n 1} such that n mod d = 0

For efficient trial division, it suffices to check divisors up to the integer square root:

isComposite(n) = n > 1 d [2, n] : d | n

The density of composites below N is given by the complement of the Prime Counting Function π(N):

C(N) N Nln(N) 1

Where C(N) is the count of composites in [2, N], and the 1 accounts for excluding 1. The trial division complexity per number is O(n). For range mode, a sieve approach runs in O(n log log n).

Reference Data

OrdinalComposite NumberSmallest Prime FactorFactorizationNumber of Divisors
142223
2622 × 34
382234
493323
51022 × 54
612222 × 36
71422 × 74
81533 × 54
9162245
101822 × 326
1120222 × 56
122133 × 74
132222 × 114
1424223 × 38
15255523
162622 × 134
17273334
1828222 × 76
193022 × 3 × 58
20322256
253822 × 194
507022 × 5 × 78
10013377 × 194
500620222 × 5 × 3112
10001197332 × 7 × 1912

Frequently Asked Questions

By the Fundamental Theorem of Arithmetic, every integer greater than 1 has a unique prime factorization. Including 1 as prime or composite would break this uniqueness. The convention established by OEIS (A002808) and ISO 80000-2 excludes 1 from both categories. The smallest composite is therefore 4 = 2 × 2.
For sequences exceeding 10,000 numbers, the generator uses chunked processing via setTimeout, yielding control back to the browser event loop every 5,000 iterations. A progress bar displays completion percentage. This prevents the UI thread from blocking while maintaining deterministic output. The maximum supported upper bound is 10,000,000.
Count mode generates exactly k composite numbers starting from a given integer, scanning upward until k composites are found. Range mode enumerates all composites within the closed interval [a, b]. Count mode is useful when you need a fixed-length sequence. Range mode is useful for analyzing composite density within a specific numeric band.
Yes. Consecutive composite sequences (called prime gaps minus 1) grow longer as numbers increase. For example, 8 and 9 are both composite. Arbitrarily long runs of consecutive composites exist: for any k, the sequence (k+1)! + 2, (k+1)! + 3, …, (k+1)! + (k+1) contains k consecutive composites. The first run of 5 consecutive composites starts at 24 (24, 25, 26, 27, 28).
Trial division is deterministic and exact for numbers within this tool's range (up to 10,000,000). Probabilistic tests like Miller-Rabin are designed for numbers with hundreds of digits where trial division is computationally infeasible. For n ≤ 10^7, trial division up to √n requires at most 3,162 checks per number, which completes in microseconds on modern hardware.
The generator begins scanning from your specified start value but will only collect numbers that satisfy the composite test (n > 1 and has a non-trivial divisor). If you start at 1, numbers 1, 2, and 3 are skipped, and collection begins at 4. The output always contains only valid composites regardless of your start value.