Prime factorization of large numbers

What is the largest prime factor of 6008514751439?


The answer is 608087719.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Aryan Gaikwad
Mar 21, 2015

Here is my best shot with Java. It takes about 4 seconds to run on my machine.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
public static void main(String args[]){
    double max = 6008514751439d, lar = 0;
    for(double n = 1; n <= max; n++)
        if(max % n == 0){
            max /= n;
            if(prime(n) && n > lar)
                lar = n;
        }
    System.out.println(lar);
}

static boolean prime(double n){
    if(n % 2 == 0) return false;
    for(double i = 3; i * i < n; i += 2)
        if(n % i == 0) return false;
    return true;
}

Bill Bell
Sep 26, 2015

Programmers try not to re-invent the wheel.

>> from sympy import factorint

>> factorint(6008514751439)

{41: 1, 608087719: 1, 241: 1}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...