20 lines
389 B
Text
20 lines
389 B
Text
import system'routines;
|
|
import system'math;
|
|
import extensions;
|
|
|
|
extension extension
|
|
{
|
|
isPerfect()
|
|
= new Range(1, self - 1).selectBy::(n => (self.mod(n) == 0).iif(n,0) ).summarize(new Integer()) == self;
|
|
}
|
|
|
|
public Program()
|
|
{
|
|
for(int n := 1; n < 10000; n++)
|
|
{
|
|
if(n.isPerfect())
|
|
{ Console.printLine(n," is perfect") }
|
|
};
|
|
|
|
Console.readChar()
|
|
}
|