This Mersenne number calculator computes 2 to the power p, minus 1, for an exponent you choose. Enter p and the calculator returns the Mersenne number, how many decimal digits it has, and whether p itself is prime, which is a necessary first condition for the Mersenne number to be prime. Mersenne numbers are named after Marin Mersenne and are central to the search for very large primes: the largest known primes are almost all Mersenne primes, found by the distributed GIMPS project. A Mersenne number can only be prime if its exponent is prime, though that alone is not enough. The formula, a worked example and the assumptions are set out below.
The Mersenne number for exponent p is M_p = 2^p minus 1. If M_p is prime it is a Mersenne prime, and a Mersenne prime requires p to be prime (but a prime p does not guarantee one).
For p = 7, M_7 = 2^7 minus 1 = 128 minus 1 = 127, which is prime, so 127 is a Mersenne prime. For p = 11, M_11 = 2047 = 23 times 89, not prime. Enter 7 to confirm.
A number of the form 2 to the power p, minus 1. When it is also prime it is called a Mersenne prime.
If p is composite then 2^p minus 1 factors, so it cannot be prime. A prime p is necessary but not sufficient.
There is a very efficient primality test (Lucas-Lehmer) for Mersenne numbers, which makes searching them practical.
This calculator is for students, programmers and anyone exploring number theory.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use
Reviewed and maintained. Last reviewed 2026-06-21 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.
© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.