Perfect numbers: Difference between revisions

Content added Content deleted
m (→‎optimized using digital root: added whitespace.)
m (→‎optimized using only even numbers: added whitespace for the head of a DO loop .)
Line 1,532: Line 1,532:
w=length(high) /*use W for formatting output. */
w=length(high) /*use W for formatting output. */
numeric digits max(9,w+2) /*ensure enough digits to handle#*/
numeric digits max(9,w+2) /*ensure enough digits to handle#*/

do i=low to high by 2 /*process the single # or range. */
do i=low to high by 2 /*process the single # or range. */
if isPerfect(i) then say right(i,w) 'is a perfect number.'
if isPerfect(i) then say right(i,w) 'is a perfect number.'