package java算法; /* * 一个完数等于它的因子之和 6=1+2+3 */ public class wanshu { public static void main(String[] args) { // TODO Auto-generated method stub int k=2; int temp=1; int i=0; int j=0; for( int num=1;num<=1000;num++){ k=2; temp=1; j=num; while(j>=k){ if(j%k==0){ temp+=k; j=j/k; } else{ k++; } } if(temp==num){ System.out.println(num); } } } }