Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1.  
  2. public class numero_3 {
  3.     static int max=0;
  4.     public static void main(String[] args) {
  5.         // TODO Auto-generated method stub
  6.         long nb=600851475143L;
  7.         long td=System.nanoTime();
  8.         test(nb);
  9.         long tf= System.nanoTime();
  10.         System.out.println((tf-td)/Math.pow(10,6));
  11.  
  12.     }
  13.  
  14.     public static void test(long nb){
  15.         for(int i=2;i<=nb;i++){
  16.             if(nb%i==0){
  17.                 test(nb/i);
  18.                 System.out.println(i);
  19.                 break;
  20.             }else{
  21.                 if(nb==i){
  22.                     break;
  23.                 }
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement