What This Calculator Does

Supports large integers beyond JavaScript's safe limit. Factorization of very large composites may require additional computation time.

Formulas & Rules

  • Primality Test: n is prime if no integer d where 2 ≤ d ≤ √n divides n evenly.
  • Prime Factorization: Every integer n > 1 can be written uniquely as a product of prime powers: n = p₁^a₁ × p₂^a₂ × ... × pₖ^aₖ.
  • Divisor Count: If n = p₁^a₁ × p₂^a₂ × ... × pₖ^aₖ, then d(n) = (a₁+1)(a₂+1)...(aₖ+1).
  • Divisor Sum: σ(n) = ∏ [(pᵢ^(aᵢ+1) − 1) / (pᵢ − 1)]
  • Twin Primes: (p, p+2) where both p and p+2 are prime.

Examples

  • Prime Check: 97 → Prime. Position: 25th. Previous: 89 (gap 8). Next: 101 (gap 4).
  • Composite: 91 → Composite. 91 = 7 × 13. Smallest prime factor: 7.
  • Factorization: 360 = 2³ × 3² × 5. Total prime factors: 6. Unique: 3. Sum: 10.
  • Nth Prime: The 100th prime is 541.
  • Range: Primes between 1 and 100 → 25 primes (2, 3, 5, 7, ..., 97).
  • Twin Prime: 29 and 31 are twin primes.

Frequently Asked Questions

Q: What is a prime number?

A prime number is a positive integer greater than 1 that has exactly two positive divisors: 1 and itself. For example, 2, 3, 5, 7, 11, and 97 are prime numbers.

Q: Is 1 a prime number?

No. 1 is neither prime nor composite because it has only one positive divisor. Prime numbers must have exactly two distinct positive divisors.

Q: Is 0 a prime number?

No. 0 is neither prime nor composite. By definition, prime numbers are positive integers greater than 1.

Q: Can negative numbers be prime?

No. The definition of prime numbers applies only to positive integers greater than 1. Negative numbers, zero, and one are not classified as prime.

Q: How does the prime checker work?

The calculator tests whether any integer from 2 through the square root of the number divides it evenly. If none do, the number is prime. For very large numbers, it uses additional optimized algorithms.

Q: What is prime factorization?

Prime factorization breaks a composite number down into a product of prime numbers. For example, 360 = 2³ × 3² × 5. The calculator shows both the factor list and step-by-step division.

Q: What is a twin prime?

Twin primes are pairs of primes that differ by 2, such as (3, 5), (5, 7), (11, 13), or (29, 31). The calculator checks if your number is part of a twin-prime pair.

Q: What is a prime gap?

A prime gap is the difference between two consecutive prime numbers. For example, the gap between 89 and 97 is 8. The calculator shows gaps to the previous and next prime.

Q: How large a number can this calculator handle?

The calculator supports large integers beyond JavaScript's safe integer limit using BigInt arithmetic. Factorization of very large composite numbers may become computationally intensive — the calculator warns you when this happens.

Q: What is the nth prime?

The nth prime is the prime number that occupies position n in the sequence of primes. For example, the 25th prime is 97, and the 100th prime is 541.

Loaded shared calculation