Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,29 @@
public class Pernicious{
//very simple isPrime since x will be <= Long.SIZE
public static boolean isPrime(int x){
if(x < 2) return false;
for(int i = 2; i < x; i++){
if(x % i == 0) return false;
}
return true;
}
public static int popCount(long x){
return Long.bitCount(x);
}
public static void main(String[] args){
for(long i = 1, n = 0; n < 25; i++){
if(isPrime(popCount(i))){
System.out.print(i + " ");
n++;
}
}
System.out.println();
for(long i = 888888877; i <= 888888888; i++){
if(isPrime(popCount(i))) System.out.print(i + " ");
}
}
}