Perfect numbers: Difference between revisions

m
(Add Spad code)
Line 89:
=={{header|Axiom}}==
{{trans|Mathematica}}
Using the interpreter, we can define the function:
<lang Axiom>perfect?(n:Integer):Boolean == reduce(+,divisors n) = 2*n</lang>
Alternatively, using the Spad compiler:
Line 104:
perfect? 128
[i for i in 1..10000 | perfect? i]</lang>
Output:
gives back:
<lang Axiom>true
false
136

edits