Posts Tagged ‘dcluo

22
May
09

GoldBach, is it a prime?

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
public class goldbach {
public static double pp;

//Scanner in=new Scanner(System.in);
//DCLUO
public static boolean goodDiv(double a,double b){
double e=a/b;
if((int)e==e){
return true;
}

return false;
}
public static void main(String[] args) throws FileNotFoundException {
Scanner scan=null;

int a=1;
// TODO Auto-generated method stub
double ts=System.currentTimeMillis();

while(a90000){ scan = new Scanner(new FileInputStream(“primes1.txt”));}

while(a/b>2){

while(goodDiv(c,b)){
c=c/b;
System.out.print(“*”+(int)b);
}
//
if(a>900000){b=(double)scan.nextInt();}else{b++;}
}if(a>900000){scan.close();}

if (c!=1){
System.out.print(“*”+(int)c);
if(c==a){System.out.print(“\t\t PRIME”);
pp++;}

}
double ees=System.currentTimeMillis();
System.out.println(“\t\t Runtime:”+(tts-ees)+” ms”);
a++;}

}
System.out.println(“percentage of prime in range 1~”+(a-1)+”=”+100*(pp/a)+”%”);
double end=System.currentTimeMillis();
System.out.println(“Runtime:”+(end-ts)/1000+” s”);
}
}

02
May
09

My Piano Play

constructing

 

http://dcluo.wordpress.com/piano-play




Follow

Get every new post delivered to your Inbox.