DEV Community

A N M Bazlur Rahman
A N M Bazlur Rahman

Posted on • Originally published at bazlur.com on

1

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

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay