Largest known prime number

Posted on by

Categories:   

সবচেয়ে বড় মৌলিক সংখ্যাটি কতো ?

এখন পর্যন্ত খুঁজে পাওয়া সবচেয়ে বড় মৌলিক সংখ্যাটি হলো – 2^57,885,161 -1

এই লিংকে এ সম্পর্কে আরও বিস্তারিত জানা যাবে।

এতে 17,425,170 টি সংখ্যা রয়েছে। এই সংখ্যাটি দেখতে চাইলে ঝটপট একটি জাভা প্রোগ্রাম লিখে ফেলা যায়। এর জন্য জাভার BigInteger ক্লাসটি প্রয়োজন হবে।

import java.math.BigInteger;

public class LargestPrimeNumber {
    public static void main(String[] args) {
        BigInteger two = BigInteger.valueOf(2);
        BigInteger largest = two.pow(57_885_161);
        BigInteger largestPrimeNumber = largest.subtract(BigInteger.ONE);
        System.out.println(largestPrimeNumber);
    }
}

এটি প্রিন্ট হতে বেশ খানিকটা সময় নেবে।

Largest Prime Number

ফাইলে স্টোর করতে চাইলে নিচের কোড অংশটুকু যুক্ত করুন-

try {
    Files.write(Paths.get("prime.txt"), largestPrimeNumber.toString().getBytes());
} catch (IOException e) {
    e.printStackTrace();
}

 

   

Share on:

Author: A N M Bazlur Rahman

Java Champion | Software Engineer | JUG Leader | Book Author | InfoQ & Foojay.IO Editor | Jakarta EE Ambassadors| Helping Java Developers to improve their coding & collaboration skills so that they can meet great people & collaborate

100daysofcode 100daysofjava access advance-java agile algorithm arraylist article bangla-book becoming-expert biginteger book calculator checked checked-exceptions cloning code-readability code-review coding coding-convention collection-framework compact-strings completablefuture concatenation concurrency concurrentmodificationexception concurrentskiplistmap counting countingcollections critical-section daemon-thread data-race data-structure datetime day002 deliberate-practice deserialization design-pattern developers duration execute-around executors export fibonacci file file-copy fork/join-common-pool functional future-java-developers groupby hash-function hashmap history history-of-java how-java-performs-better how-java-works http-client image import inspiration io itext-pdf java java-10 java-11 java-17 java-8 java-9 java-developers java-performance java-programming java-thread java-thread-programming java11 java16 java8 lambda-expression learning learning-and-development linkedlist list local-type-inference localdatetime map methodology microservices nio non-blockingio null-pointer-exception object-cloning optional packaging parallel pass-by-reference pass-by-value pdf performance prime-number programming project-loom race-condition readable-code record refactoring review scheduler scrum serialization serversocket simple-calculator socket software-development softwarearchitecture softwareengineering sorting source-code stack string string-pool stringbuilder swing thread threads tutorial unchecked vector virtual-thread volatile why-java zoneid