20 lines
390 B
Text
20 lines
390 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 += 1)
|
|
{
|
|
if(n.isPerfect())
|
|
{ console.printLine(n," is perfect") }
|
|
};
|
|
|
|
console.readChar()
|
|
}
|