Composite Number Generator
Generates a random composite number (a whole number greater than 1 that isn't prime) within a range you choose.
What this generator does
Picks a composite number — one with divisors other than itself and one, so every whole number above 1 that is not prime. Useful for maths practice on factors and divisibility.
How to use this tool
- Set your minimum and maximum.
- Press generate for a random composite number.
Worked examples
- Examples
- 4, 6, 8, 9, 10, 12, 14, 15, 16 — the composites below 18
Common use cases
- Prime vs composite number practice
- Maths teaching examples
- Quick number-theory puzzles
How this generator works
A number is drawn from your range and tested for primality; primes are rejected and another drawn, so every result has a factorisation. The factorisation is shown alongside, because that is what makes a number composite — 91 looks prime until you see it as 7 × 13, which is exactly the kind of number this is useful for.
Limitations and good to know
- 1 is neither prime nor composite, and is never returned.
- 1 is neither prime nor composite and is never produced, which is a definition rather than an edge case.
- Composite numbers are far more common than primes as ranges grow, so rejection sampling here is quick — the reverse would not be.
- The factorisation shown is into primes. A composite number generally has many other factor pairs as well.