31 (thirty-one) is the natural number following 30 and preceding 32.
Thirty-one is the third Mersenne prime (25 − 1) as well as the fourth primorial prime, and together with twenty-nine, another primorial prime, it comprises a twin prime. As a Mersenne prime, 31 is related to the perfect number 496, since 496 = 2(5 − 1)(25 − 1). 31 is the eighth Mersenne prime exponent. 31 is also the 4th lucky prime and the 11th supersingular prime.
31 is a centered triangular number, the lowest prime centered pentagonal number and a centered decagonal number.
For the Steiner tree problem, 31 is the number of possible Steiner topologies for Steiner trees with 4 terminals.
At 31, the Mertens function sets a new low of −4, a value which is not subceded until 110.
No integer added up to its base 10 digits results in 31, making 31 a self number.
31 is a repdigit in base 5 (111), and base 2 (11111).
The numbers 31, 331, 3331, 33331, 333331, 3333331, and 33333331 are all prime. For a time it was thought that every number of the form 3w1 would be prime. However, the next nine numbers of the sequence are composite; their factorisations are:
He needs me
He doesn't know it, but he needs me
And so no matter where he goes
Though he doesn't care
He knows that I'm here
He needs me
I ought to leave him, but he needs me
I know that I'm not very bright
Just to tag along
Oh, but right or wrong
I'm his and I'm here
And I'm gonna be his friend or his lover
'Cause my one ambition is
To wake him and make him discover
That he needs me
I've got to follow where he leads me
Or else he'll never know that I need him