Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Pernicious-numbers/Groovy/pernicious-numbers.groovy
Normal file
24
Task/Pernicious-numbers/Groovy/pernicious-numbers.groovy
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
class example{
|
||||
static void main(String[] args){
|
||||
def n=0;
|
||||
def counter=0;
|
||||
while(counter<25){
|
||||
if(print(n)){
|
||||
counter++;}
|
||||
n=n+1;
|
||||
}
|
||||
println();
|
||||
def x=888888877;
|
||||
while(x<888888889){
|
||||
print(x);
|
||||
x++;}
|
||||
}
|
||||
static def print(def a){
|
||||
def primes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47];
|
||||
def c=Integer.toBinaryString(a);
|
||||
String d=c;
|
||||
def e=0;
|
||||
for(i in d){if(i=='1'){e++;}}
|
||||
if(e in primes){printf(a+" ");return 1;}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue