GenerateRandomSearch

Composite Number Generator

Generates a random composite number — a whole number greater than 1 that isn't prime — within a range you choose, drawing candidates and testing each for primality until one fails the test, for prime-versus-composite and factor-and-divisibility practice.

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

  1. Set your minimum and maximum.
  2. 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 is drawn, so the result always has a divisor other than 1 and itself. Only the number is shown — finding its factors is left as the exercise. 91 looks prime until you try 7, 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 produced, which is a definition rather than an edge case.
  • The range must lie between 4 and 100,000. A bound typed outside that is pulled back to 4 or 100,000 when you leave the field; a minimum above the maximum is refused with a message rather than swapped. It starts at 4 to 255.
  • No factorisation is shown alongside the number; working out why it is composite is your step.
  • Composite numbers are far more common than primes as ranges grow, so rejection sampling here is quick — the reverse would not be.