[2024-09-29 note: This was previously posted on Cohost, on 2023-03-25 at https://cohost.org/ireneista/post/1232513-so-a-friend-mentione but the irenes.space URL is the permanent one.]
[this is a cross-post with Mastodon, it felt like a good subject to experiment with cross-posting, see https://mastodon.social/@irenes/110086029818846400 for the thread over there; there are minor edits]
so a friend mentioned Mersenne primes today and for some reason, even though we'd been hearing that phrase all our life, it clicked in our head in a way it previously hadn't
...
a Mersenne prime is a prime in the form 2^n - 1
if your programming experience is remotely like ours, you KNOW the values of 2^n - 1
...
we can list off the first sixteen of them without even thinking about it - 0 1 3 7 15 31 63 127 255 511 1023 2047 4095 8191 16383 32767 65535A
when we see one of those numbers we know which n it comes from
when you give us an n we can tell you that number
we don't need to pause and count in order to do that
these numbers are OLD FRIENDS
...
we even know a few 2^n and 2^n - 1 for select values of 2 greater than 16, although they're friends we don't see as often and have fallen out of touch with
...
but it turns out
and this is the part that feels SO WEIRD to us
SOME 2^n -1 are prime
and some are not
...
you don't believe us? look at 2047
it has FACTORS!!!!
23 and 89, in fact
it's like learning that SOME of our friends have had a secret club, all these years, where they go hang out
the Mersenne club
and they don't tell our other friends about it!!!! how rude
...
...
...
anyway if this has helped you to learn what Mersenne primes are (it sure helped us) you will also want to keep in mind that there are two closely related sets of numbers here.
the Mersenne primes themselves (3, 7, 31, 127, 8191) ... those are one sequence, and they are rudely excluding (0, 1, 15, 63, 255 and everything up to 4095)
and the exponents that give rise to them are a DIFFERENT sequence, though in 1:1 with the Mersenne primes (2, 3, 5, 7, 13)
our friend also helped us to understand the relationship between the Mersenne primes and the perfect numbers, which was very surprising to us, but our brain could only fully absorb one epiphany at a time because we're getting old, so we'll leave the post there
primes are weird. what ARE primes?