Perfect numbers: Difference between revisions
m
→{{header|Axiom}}
(Add Spad code) |
|||
Line 89:
=={{header|Axiom}}==
{{trans|Mathematica}}
Using the interpreter,
<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:
<lang Axiom>true
false
|