47) 서로 다른 네 개의 소인수를 갖는 수들이 처음으로 네 번 연속되는 경우는?
http://euler.synap.co.kr/prob_detail.php?id=47
Skillist 설명---------------------------------------------------------------------------------
public static void main (String[] args){
HashSet<Integer> total = new HashSet<Integer>();
HashSet<Integer> temp = new HashSet<Integer>();
for(int i=100;;i++){
int now = i;
for(int j=2;j<=now/2;j++){
if(now%j==0){ //나누어 뗠어지면
int k=j;
while(now%k==0){
k*=j;
}
now/=(k/j);
temp.add(k/j);
if(total.contains(k/j)){ //이미 있으면
total.clear();
}
}
}
temp.add(now);
if(total.contains(now)){ //이미 있으면
total.clear();
}
if(temp.size()!=4){
temp.clear();
total.clear();
}else{
total.addAll(temp);
temp.clear();
}
if(total.size()==16){
System.out.println(total);
System.out.println(i-3);
return ;
}
}
}