Check if a number is prime and get its prime factorization instantly.
To determine if a number n is prime, we test divisibility by every integer from 2 up to √n. If none divides evenly, the number is prime — because any factor larger than √n would require a matching factor smaller than √n. For composite numbers, we repeatedly divide by the smallest prime factor found, continuing until the quotient becomes 1. This trial division method produces the complete prime factorization. For very large inputs the check may take a moment, but it remains exact for all integers within safe precision range.
A prime number is a natural number greater than 1 that has exactly two distinct positive divisors: 1 and itself. For example, 2, 3, 5, 7, and 11 are prime numbers because they cannot be divided evenly by any other number. The number 1 is not considered prime by mathematical convention.
To check if a number n is prime, test whether it is divisible by any integer from 2 up to the square root of n. If no divisor is found in that range, the number is prime. This method works because if n has a factor larger than its square root, it must also have a corresponding factor smaller than the square root.
Prime factorization is the process of breaking down a composite number into a product of its prime factors. For example, the prime factorization of 60 is 2 × 2 × 3 × 5 (or 2² × 3 × 5). Every integer greater than 1 has a unique prime factorization according to the Fundamental Theorem of Arithmetic.