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.
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:
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)