import java.lang.Math;
public class TestLi {
public static void main(String[] args) {
for ( int i = 1; i <= 999999; i++) {
int temp = i;
int count = 0;
while(temp != 0) {
temp = temp/10;
count++;
}
temp = i;
int sum = 0;
while(temp != 0) {
sum += Math.pow(temp%10,count);
temp = temp/10;
}
if(sum == i) {
System.out.print(" " + i);
}
}
}
}
水仙花数,四叶玫瑰数
最新推荐文章于 2024-02-26 14:06:26 发布