1. Java, Simon Baumgartner


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;

/*
* ACM Programming Contest
*
* Problem: 10200 Prime Time
* Status: Accepted
* Run Time: 0.652
* Date: 2009-06-29
* Author: Simon Baumgartner
*/

public class Main{

private static int LIMIT = 10000;

public static void main(String...args) throws IOException{

boolean[] primes = new boolean[LIMIT+1];
for(int i = 0; i<=LIMIT; i++)
primes[i] = isPrime(doEuler(i));
// BufferedReader in = new BufferedReader(new FileReader("input.txt"));
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = in.readLine();
do{
String[] tokens = line.split(" ");
int a = Integer.parseInt(tokens[0]);
int b = Integer.parseInt(tokens[1]);
int total = b-a + 1;
int primeCount = 0;
for(int i = a; i <= b; i++){
if(primes[i] == true)
primeCount++;
}
double percentage = Math.round((primeCount/(double)total) * 10000)/100.0;
System.out.printf("%.2f\n",percentage);


}while((line = in.readLine() ) != null);
}

private static long doEuler(long n){
return (n * n) + n + 41;
}

private static boolean isPrime(long n) {
if (n < 2)
return false;
for (long i = 2; i*i <= n; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}