You are viewing a single comment's thread. Return to all comments →
Java Solution:
class Result {
public static int primeCount(long n) { // Write your code here if(n==1){ return 0; }else if(n<=5){ return 1; }else if(n >= Long.parseLong("614889782588491410")){ return 15; }else{ List<Integer> prime=new ArrayList<>(Arrays.asList( 2,3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,61, 67)); long l=1; long h=1; for(int i=0;i< prime.size()-1; i++){ l=h; h *=Long.parseLong(Integer.toString(prime.get(i)) ); if(n >= l && n < h){ return i; } } } return -1; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
Java Solution:
class Result {
}