HexMathv1.0.4

Prime number checker and calculator

This prime number checker tells you whether a whole number is prime and shows why. Type the number or scan it. HexMath tests the primes up to its square root, says whether the number is prime, and writes its prime factorization with powers, such as 360 = 2³ · 3² · 5, one division at a time.

Loading math input...

What this page covers

  • Checking whether a whole number is prime by testing primes up to its square root.
  • Prime factorization, written with powers, such as 360 = 2³ · 3² · 5.
  • Listing or counting the primes below a number.
  • Not covered here: tests for numbers with hundreds of digits. To reduce a fraction with these factors, use the fraction calculator.

How to enter the problem

  • Type the question with the number, such as Is 221 prime? or Prime factorization of 360.
  • Scan it. Fit the one problem in the frame.
  • Choose a photo. Several problems in one photo are solved as a list.
  • Then tap Solve.

Worked examples

Example 1: Find the smallest prime factor of 323.

Problem

Find the smallest prime factor of 323.

Answer

Verified

The answer is

1717

Explanation

  1. Decide how far to test
    323≈17.97\sqrt{323} \approx 17.97, so only the primes up to 1717 need checking: 2,3,5,7,11,13,172, 3, 5, 7, 11, 13, 17.
  2. Rule out 2, 3 and 5
    323323 is odd; its digit sum 3+2+3=83 + 2 + 3 = 8 is not a multiple of 33; it does not end in 00 or 55.
  3. Test 7, 11 and 13
    7⋅46=3227 \cdot 46 = 322, remainder 11. 11⋅29=31911 \cdot 29 = 319, remainder 44. 13⋅24=31213 \cdot 24 = 312, remainder 1111.
  4. Test 17
    17⋅19=32317 \cdot 19 = 323 exactly, so 1717 divides 323323.
  5. Conclude
    323=17×19323 = 17 \times 19. The smallest prime factor is 1717, and 323323 is not prime.

Example 2: Write 360 as a product of primes.

Problem

Write 360\displaystyle 360 as a product of primes.

Answer

Verified

The answer is

360=23⋅32⋅5360 = 2^3 \cdot 3^2 \cdot 5

Explanation

  1. Divide by 2 while you can
    360→180→90→45360 \to 180 \to 90 \to 45: three factors of 22.
  2. Divide by 3 while you can
    45→15→545 \to 15 \to 5: two factors of 33.
  3. Stop at a prime
    55 is prime, so the factorization is complete.
  4. Write it with powers
    Three factors of 22, two factors of 33 and one 55
    360=23⋅32⋅5360 = 2^3 \cdot 3^2 \cdot 5

Example 3: How many prime numbers are less than 50?

Problem

How many prime numbers are less than 50\displaystyle 50?

Answer

Verified

The answer is

1515

Explanation

  1. Choose the primes to sieve with
    50≈7.1\sqrt{50} \approx 7.1, so crossing out multiples of 2,3,52, 3, 5 and 77 is enough.
  2. Cross out the multiples
    From 22 to 4949, remove every multiple of 2,3,5,72, 3, 5, 7 except those primes themselves.
  3. List what is left
    2,3,5,7,11,13,17,19,23,29,31,37,41,43,472, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47.
  4. Count
    There are 1515 numbers in the list.

Common mistakes

  • Counting 1 as a prime. A prime has exactly two factors, 1 and itself, and 1 has only one.
  • Calling a number prime because it is odd and looks unfamiliar: 51=3⋅1751 = 3 \cdot 17 and 91=7⋅1391 = 7 \cdot 13.
  • Stopping a factorization early, such as 360=23⋅3⋅5360 = 2^3 \cdot 3 \cdot 5, which is 120120, not 360360.
  • Testing every number up to n. Testing the primes up to the square root of n is enough.

Checks, assumptions and limits

  • Multiply the factors back together: 23⋅32⋅5=8⋅9⋅5=3602^3 \cdot 3^2 \cdot 5 = 8 \cdot 9 \cdot 5 = 360.
  • Prime and composite apply to whole numbers greater than 1. The numbers 0 and 1 are neither.
  • 2 is the only even prime, so any other even number is composite.
  • Shortcuts before dividing: a number ending in 0, 2, 4, 6 or 8 is divisible by 2; if its digits add up to a multiple of 3, it is divisible by 3; if it ends in 0 or 5, it is divisible by 5.
  • HexMath can make mistakes. Double check important steps.

Frequently asked questions

No. A prime has exactly two different factors, 1 and itself. The number 1 has only one factor, so it is neither prime nor composite.

If n = a × b and both a and b were larger than the square root of n, their product would be larger than n. So every factor pair has one member at or below the square root.

Choose a photo of the list. Several problems in one photo are solved as a list. You can also type each number as its own question.

Yes. Ask for the prime factors of a whole number. The steps divide by each prime in turn and the result is written with powers, such as 360 = 2³ · 3² · 5.

A whole number greater than 1 whose only factors are 1 and itself. 2, 3, 5, 7 and 11 are prime; 9 is not, because 9 = 3 · 3. 2 is the only even prime, because every other even number has 2 as a factor.

Divide it by each prime up to its square root. If none divides it exactly, it is prime. For 97 the square root is about 9.8, so test 2, 3, 5 and 7. None divides 97, so 97 is prime.

Ready to solve your next math problem?

Create a free account for 3 math questions a day in your browser. No card.

Get HexMath on your phone

The same solver and camera scan on iPhone and Android.

Last updated: · HexMath