Przejdź do treści
Liczbnik

Prime Number Calculator

Enter any natural number (from 2 to 1,000,000,000) and choose a mode: primality check, finding the next prime, or prime factorization. The calculator instantly shows the result and whether the entered number is prime.

Reviewed byRedakcja Liczbnik
Calculator
ResultResult17
Is prime (1=yes, 0=no)
1

How it works

For primality checking, we use trial division: we check whether n is divisible by any number from 2 to √n. If not — the number is prime. For factorization, we iteratively divide the number by consecutive divisors starting from 2. The algorithm correctly handles numbers up to 1,000,000,000.

Example: checking the number 17

Enter 17 and choose the "check" mode. The calculator confirms that 17 is prime (divisible only by 1 and 17). The "next prime" mode will show 19. The "factorization" mode for 12 returns the factor 2 (factorization: 2 × 2 × 3).

Frequently asked questions

What is a prime number?

A prime number is a natural number greater than 1 that is divisible only by 1 and itself. Examples: 2, 3, 5, 7, 11, 13, 17, 19. The number 2 is the only even prime. Numbers like 4, 6, 9, and 15 are not prime because they have other divisors.

How do you check if a number is prime?

The simplest method is trial division: divide the number n by all integers from 2 to √n. If none divides n evenly, the number is prime. For n=17, we check divisors up to √17 ≈ 4.1 — none of 2, 3, 4 divides 17, so 17 is prime. Our calculator uses this method.

What is the largest known prime number?

The largest known prime (as of 2024) is the Mersenne prime 2^136,279,841 − 1, discovered by the GIMPS project. It has over 41 million digits. The search for ever-larger primes is an active area of mathematics and computing.

How many prime numbers are there?

Euclid proved around 300 BC that there are infinitely many primes. The prime number theorem states that the number of primes less than n is approximately n / ln(n). Below 1,000 there are 168 primes; below 1,000,000 — as many as 78,498.

What is prime factorization?

Every natural number greater than 1 can be uniquely written as a product of prime numbers (up to ordering). For example: 12 = 2 × 2 × 3, 30 = 2 × 3 × 5, 100 = 2 × 2 × 5 × 5. This is called the Fundamental Theorem of Arithmetic.

How does the Sieve of Eratosthenes work?

The Sieve of Eratosthenes is an ancient algorithm for finding all primes up to a given limit. Start with 2 and cross out all its multiples; then move to the next uncrossed number and repeat. Numbers that remain uncrossed are prime. The method is efficient for limits up to several million.

Indicative result

The result is for computational purposes. For numbers above 10^9, more advanced algorithms (e.g., Miller-Rabin) are required — this calculator handles numbers up to 1,000,000,000.
  • Percentage Calculator

    Calculate what percent A is of B, find X% of a number, percentage change or add a percent to a value. Fast percentage calculator online, free.

    Maths
  • Triangle Calculator

    Calculate triangle area, perimeter and angles using Heron's formula. Enter three sides or two sides and an angle — free geometry calculator online.

    Maths
  • Compound Interest Calculator

    Calculate final capital with compound interest. Enter annual rate, term and compounding frequency — free investment calculator with PLN result online.

    Maths