Hverdag · verktøy

Primtallskontroll

Skriv inn et heltall og finn ut med ett klikk om det er et primtall.

Kjøres i nettleseren. Ingen opplasting.

Checks integers up to one trillion locally.

—

Om verktøyet

Primtallskontroll sem complicação.

Et primtall er et heltall større enn 1 med nøyaktig to positive divisorer. For eksempel er 97 et primtall, mens 1 og 91 ikke er det. Kontroller ikke-negative heltall opptil 1 000 000 000 000 i nettleseren.

Veiledning

Slik bruker du Primtallskontroll

This page tells you whether a whole number is prime. Type a number, press the button, and read the verdict: Prime number or Not prime. When the number is not prime, the page also shows one way to split it into two factors, such as 91 = 7 × 13. Numbers up to one trillion are checked by plain division. Larger ones, up to 3,317,044,064,679,887,385,961,980, go through a fixed Miller-Rabin test whose answer is exact in that range. It suits students, puzzle fans and programmers. It does not list every prime factor, find the next prime, or accept negative numbers and decimals. Everything runs in your browser.

Slik gjør du

  1. Click the Whole number box and type digits only. Leave out commas, spaces, decimal points and any minus sign.
  2. Press Check number. The answer appears in the result line under the buttons.
  3. Read the first words. Prime number means the only divisors are 1 and the number itself. Not prime means there is at least one other divisor.
  4. If the number is not prime, look after the dot for a line such as 91 = 7 × 13. It is one factor pair, not the full breakdown.
  5. If you see Enter a whole number, check for a decimal, a negative sign, a letter, an exponent such as 1e30, or a value past the upper limit.
  6. Press Clear to empty the box and the result, then test another number.

Eksempler

A small prime: 97

Du skriver inn
Tall
97
Du får
Resultat
Prime number

No whole number from 2 to 9 divides 97, and 9 is the largest to try because 10 times 10 is already more than 97. So only 1 and 97 divide it.

Kjørt med verktøyets egen kode.

A small composite: 91

Du skriver inn
Tall
91
Du får
Resultat
Not prime · 91 = 7 × 13

91 looks odd and prime-like, but 7 times 13 is 91. For numbers up to one trillion the factor shown is the smallest one above 1.

Kjørt med verktøyets egen kode.

The number 1

Du skriver inn
Tall
1
Du får
Resultat
Not prime

A prime needs exactly two divisors, and 1 has only one. The same goes for 0. Neither shows a factor line, because there is nothing to split.

Kjørt med verktøyets egen kode.

A large composite: 998244359987710471

Du skriver inn
Tall
998244359987710471
Du får
Resultat
Not prime · 998244359987710471 = 998244353 × 1000000007

This is over one trillion, so the big-integer test runs. It is the product of two nine-digit primes, and the page finds and shows both.

Kjørt med verktøyets egen kode.

The top of the range: 3317044064679887385961980

Du skriver inn
Tall
3317044064679887385961980
Du får
Resultat
Not prime · 3317044064679887385961980 = 2 × 1658522032339943692980990

This is the highest accepted value. It is even, so the answer is quick. Adding 1 gives a number the page refuses.

Kjørt med verktøyets egen kode.

A decimal is refused

Du skriver inn
Tall
3.5
Du får
Feil
Enter a whole number.

Primes are defined for whole numbers only. The same message appears for negatives, letters and large exponent notation such as 1e30.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check a homework answer when you are learning about primes and composite numbers.
  • Test a candidate number while building a puzzle, a riddle or a classroom exercise.
  • Confirm that a value you generated in a program really is prime before you use it as a hash table size.
  • Find one divisor of a number to see why it fails, for example in a divisibility lesson.
  • Settle an argument about whether a number such as 1 or 91 counts as prime.
  • Try out very large numbers to see how a deterministic primality test behaves.

Begrensninger

  • Accepts whole numbers from 0 up to 3,317,044,064,679,887,385,961,980. The value 3,317,044,064,679,887,385,961,981 and anything above it is refused.
  • A refused number shows the same short message, Enter a whole number, even when the real cause is that it is too big.
  • Negative numbers, decimals, commas, spaces and letters are not accepted. Exponent notation is unreliable: 1e30 is refused, and so is 1e13, but 1e5 is read as 100000. Type plain digits.
  • Only one factor pair is shown for a composite number. This is not a prime factorisation, so 360 does not become 2 × 2 × 2 × 3 × 3 × 5.
  • Up to one trillion, the factor shown is the smallest divisor. Above that, it is the smallest one below 100,000 if there is one, otherwise whatever the search finds, which may not be the smallest.
  • Above one trillion, the factor search stops after about 0.3 seconds. A composite number made of two very large primes can show Not prime with no factor line. The verdict itself is not affected.

Tips

  • Paste the number into the box instead of retyping it. A single wrong digit in a long number changes the answer completely.
  • To check a result by hand, multiply the two factors shown and see whether you get your number back.
  • A number ending in 0, 2, 4, 5, 6 or 8 can only be prime if it is 2 or 5. This quick glance saves you a click.
  • If you need all the prime factors, run the second factor through the checker again and keep splitting until you see Prime number.
  • When a long composite shows no factor line, the verdict still stands. Treat the missing line as a time cut, not as a sign of a prime.

Kilder

Vanlige spørsmål

Sobre Primtallskontroll.

How do I check if a number is prime?

Type a whole number in the box and press Check number. The page replies with Prime number or Not prime. If it is not prime, it adds a line that splits the number into two factors, so you can see why it failed.

Is 1 a prime number?

No. A prime must have exactly two different divisors, 1 and itself. The number 1 has only one divisor, so it is not prime. The number 0 is not prime either, and the page answers Not prime for both.

What is the biggest number I can test?

The upper limit is 3,317,044,064,679,887,385,961,980, which has 25 digits. A number one higher, or larger, is refused with the message Enter a whole number. Smaller whole numbers, including 0 and 1, are all accepted.

How can the page be sure about such a huge number?

Above one trillion it runs a Miller-Rabin test using the first 13 prime bases. Researchers showed that no composite number below the limit passes all 13 bases, so the yes or no answer is exact there. It is not a guess or a probability.

Why does a composite number show only one factor?

The page is a primality checker, not a factoring tool. It shows a single pair of factors as evidence that the number is not prime. To get the full prime breakdown, test the second factor again and repeat.

Why is there sometimes no factor line for a big composite?

For numbers above one trillion, finding a factor can take long, so the search stops after about 0.3 seconds. When that happens you still see Not prime, just without the equation. The verdict comes from a separate test and stays correct.

Why do I get Enter a whole number?

The box rejects anything that is not a plain non-negative whole number. Decimals like 3.5, a minus sign, letters, commas and large exponent forms like 1e30 all trigger it. So does a value at or above 3,317,044,064,679,887,385,961,981.

Is 2 prime, and is it the only even prime?

Yes to both. The number 2 has only the divisors 1 and 2. Every other even number can also be divided by 2, so each has at least three divisors. Type 2 into the box and the page confirms Prime number.

Is my number sent anywhere?

No. The test runs in your own browser, and the status line says the number was checked locally. Nothing you type is uploaded, saved on a server or shared with anyone.

How is this different from a prime factorisation tool?

A factorisation tool returns every prime that multiplies to your number, such as 2 × 2 × 3 for 12. This page answers one question, prime or not, and shows at most one factor pair. It also does not find the next or previous prime.

Can I use it to make or test encryption keys?

It is meant for learning and checking numbers, not for building security. Real keys are hundreds of digits long, far above this limit, and should come from a trusted cryptography library. Use this page to explore how primes behave.

Hvordan bruker du Primtallskontroll?

Skriv inn et heltall og finn ut med ett klikk om det er et primtall.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.