Composite Number Sequence Generator
Generate sequences of composite numbers by count or range. Configurable delimiters, export options, and instant validation using trial division.
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.
Formulas
A number n is composite if and only if it satisfies both conditions:
For efficient trial division, it suffices to check divisors up to the integer square root:
The density of composites below N is given by the complement of the Prime Counting Function π(N):
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
| Ordinal | Composite Number | Smallest Prime Factor | Factorization | Number of Divisors |
|---|---|---|---|---|
| 1 | 4 | 2 | 22 | 3 |
| 2 | 6 | 2 | 2 × 3 | 4 |
| 3 | 8 | 2 | 23 | 4 |
| 4 | 9 | 3 | 32 | 3 |
| 5 | 10 | 2 | 2 × 5 | 4 |
| 6 | 12 | 2 | 22 × 3 | 6 |
| 7 | 14 | 2 | 2 × 7 | 4 |
| 8 | 15 | 3 | 3 × 5 | 4 |
| 9 | 16 | 2 | 24 | 5 |
| 10 | 18 | 2 | 2 × 32 | 6 |
| 11 | 20 | 2 | 22 × 5 | 6 |
| 12 | 21 | 3 | 3 × 7 | 4 |
| 13 | 22 | 2 | 2 × 11 | 4 |
| 14 | 24 | 2 | 23 × 3 | 8 |
| 15 | 25 | 5 | 52 | 3 |
| 16 | 26 | 2 | 2 × 13 | 4 |
| 17 | 27 | 3 | 33 | 4 |
| 18 | 28 | 2 | 22 × 7 | 6 |
| 19 | 30 | 2 | 2 × 3 × 5 | 8 |
| 20 | 32 | 2 | 25 | 6 |
| 25 | 38 | 2 | 2 × 19 | 4 |
| 50 | 70 | 2 | 2 × 5 × 7 | 8 |
| 100 | 133 | 7 | 7 × 19 | 4 |
| 500 | 620 | 2 | 22 × 5 × 31 | 12 |
| 1000 | 1197 | 3 | 32 × 7 × 19 | 12 |