DEV Community

A N M Bazlur Rahman
A N M Bazlur Rahman

Posted on Originally published at bazlur.com on

Let's find out the most enormous known prime number using java

According to Wikipedia, the biggest known prime number (as of December 2020) is 2^82,589,933 − 1, which has 24,862,048 digits when printed in base 10.

The number itself is unfathomable.

Let’s write a java program that calculates this number and writes it in a text file.

100DaysOfProgramming_Day013

It doesn’t take much time to calculate the number, but writing on file or flushing on Standard output would take quite a significant time.

The file is quite large: 24.9 MB. Any text editor would struggle to open it.

Here is a glimpse of the number:

TheLargestPrimeNumber

If you want to see this on yourself then this file: theLargestKnownPrime

for copy/paste pleasure: https://github.com/rokon12/100DaysOfJava/blob/main/src/main/java/com/bazlur/Day013.java

Top comments (0)