Perfect numbers: Difference between revisions

m
→‎optimized using only even numbers: optimized further by using even numbers.
m (→‎traditional method: added whitespace (blank line).)
m (→‎optimized using only even numbers: optimized further by using even numbers.)
Line 1,509:
if low=='' then low=1 /*if no LOW, then assume unity.*/
if high=='' then high=low /*if no HIGH, then assume LOW. */
if low//2 then low=low+1 /*if LOW is odd, bump it by one.*/
w=length(high) /*use W for formatting output. */
numeric digits max(9,w+2) /*ensure enough digits to handle#*/
do i=low to high by 2 /*process the single # or range. */
if isPerfect(i) then say right(i,w) 'is a perfect number.'
end /*i*/