Problem 5 was easy, but was taking a long time in Python. So I tried it in Java, it took around 8 min to get the answer.
Here’s the code.
public class Problem5 {
public static void main(String[] args) {
Problem5 prob = new Problem4();
double number = 1.0;
while ( !prob.isDivisible(number)){
number += 1;
}
System.out.println( “————-” + number );
}
public boolean isDivisible( double number ){
boolean div = true;
for( int i =1; i <= 20 ; i ++) {
if (number % i != 0){
div = false;
}
}
return div;
}
}