← Back to Games

🚪 Prime Guardian Gate

Check if a number is prime by testing divisibility up to √N!

🏛️ The Gate of Primes
?
PRIME
🔍 Factor Pairs (checking up to √N)
Enter a number to test...

📚 Prime Number Algorithm

A prime number is only divisible by 1 and itself. To check if N is prime:

1. If N < 2, it's NOT prime
2. Check divisibility from 2 to √N
3. If ANY number divides N evenly → COMPOSITE
4. If NO divisors found → PRIME! 🎉

Why √N? If N = a × b and a ≤ √N, then b ≥ √N. So we only need to check up to √N!
This makes the algorithm O(√N) instead of O(N).