Is 31 a prime number?

5 min read
Is 31 a prime number?
is 31 prime or composite

What do the numbers 31, 331, 3 331, 33 331, 333 331, 3 333 331, and 33 333 331 have in common? They are all prime numbers! That is pretty amazing! Don’t you think?

In this article, we will learn why 31 is a prime number, and more of its properties.

We will start recalling some definitions that we have widely discussed in our Prime Numbers article. If you still feel unfamiliar with these notions, we invite you to first read that article and come back here later.

A factor of a natural number is a positive divisor of the number. A proper factor of a natural number is a factor that is different from 1 and from the number itself.

For example, $$133 = 7\times19 = 1\times133$$; thus, 1, 7, 19, and 133 are all factors of 133, but only 7 and 19 are proper factors of 133.

Boost your score is 31 a prime

A natural number is called a prime number if it is greater than 1, and it doesn’t have proper factors. For example, the first prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29.

A composite number is a natural number that has proper factors. As we saw, 133 has two proper factors, thus 133 is a composite number.

what is the prime factorization of 31

Why is 31 a prime number?

Number 31 is prime because it doesn’t have proper factors. In other words, the only factors of 31 are 1 and itself. To be sure of it, we can use the following property.

If 𝒏 is a natural number, and neither of the prime numbers is less than $$\sqrt n$$ divides 𝒏, then 𝒏 is a prime number.

is 31 a prime number or a composite number

Notice that 31 < 36, thus


Therefore, the prime numbers less than


are 2, 3 and 5.

Since 31 isn’t an even number, 2 doesn’t divide 31. Moreover, $$31 = (3 \times 10) + 1$$ and $$31 = (5 \times 6) + 1$$, meaning that neither 3 nor 5 divides 31. Then, by the property above, 31 is a prime number.

On the other hand, a prime number of objects can’t be arranged into a rectangular grid with more than one column and more than one row. This is another way of verifying that 31 is a prime number:

  • For example, if we try to arrange 31 stars into a rectangular grid with three rows, one of the columns will be incomplete.The same happens if we try to arrange 31 stars into a rectangular grid with any number of rows and columns greater than one.
  • The only way of arranging 31 stars into a rectangular grid, is by having a single row, or a single column. This means that 31 is a prime number!
why is 31 a prime number

Which class of prime number is 31?

Number 31 is the 11th prime number, and 11 is also a prime number, thus 31 is a super-prime number: a prime number that occupies a prime position in the list of all prime numbers. Also, when we reverse the digits of 31, we get 13 which is another prime number!

Since 31 = 29 + 2, and 29 is a prime number, then 31 is a twin prime: this is, a prime number that is 2 less or 2 more than another prime number.

Thirty-one can be classified into many classes of primes numbers. We will name three classes here, and then we will see to which of them 31 belongs.

Classes of Prime Numbers
Primoral prime It is a prime number of the form
are the first n prime numbers.
Mersenne prime It is a prime number of the form
where n is an integer.
Safe prime It is a prime number of the form 2p + 1 where p is also a prime number. No

Let’s find out why:

  • Notice that if we use the first three prime numbers 2, 3, and 5 in the primoral formula, we get (2×3×5)+1=31. Thus, 31 is a primoral prime!
  • Since
    $$2^5\;-\;1=32-1=31$$, number 31 is also a Mersenne prime.
  • Let’s consider the values that takes 2p + 1, for different primes p:
p2p + 1
2(2) + 1 = 5
32(3) + 1 = 7
52(5) + 1 = 11
72(7) + 1 = 15
112(11) + 1 = 23
132(13) + 1 = 27
172(17) + 1 = 35

Since 31 is not in the right column, it doesn’t have the form of a safe prime.

We invite you to read other articles on prime numbers, on our blog, to find out which other prime numbers belong to these classes.

Do you know that 29 is a prime number?

Frequently Asked Questions