This Mersenne number calculator works out 2 to the power p, minus 1, for any exponent p you enter, along with two facts that matter in number theory: how many digits the result has and whether p itself is prime. You type in a whole number exponent between 1 and 5000, and the calculator uses exact integer arithmetic to return the full Mersenne number grouped with commas for readability, its digit count, and a yes or no on whether p is prime. This matters because a Mersenne number can only be prime if its exponent is prime; a composite p guarantees the result factors, though a prime p is no guarantee either, since many prime exponents still produce composite Mersenne numbers. Mersenne numbers, named after the French friar Marin Mersenne, sit at the heart of the hunt for record-breaking primes, because an efficient test called Lucas-Lehmer makes checking them for primality far quicker than testing ordinary numbers of similar size, which is why nearly every largest known prime found by the GIMPS project has been a Mersenne prime. Try the default value of 7 for the worked example: 2 to the 7 minus 1 equals 127, a genuine Mersenne prime, then try 11 to see 2047, which factors as 23 times 89. This tool suits students, programmers and anyone curious about number theory, not anyone needing a financial estimate.
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.
Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.
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 by 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-08-07 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.