Anonymous user
Perfect numbers: Difference between revisions
m
→Lucas-Lehmer + other optimizations: added a comment for the "Lucus'" numbers.
m (→optimized using only even numbers: added whitespace for the head of a DO loop .) |
m (→Lucas-Lehmer + other optimizations: added a comment for the "Lucus'" numbers.) |
||
Line 1,607:
w=length(high) /*use W for formatting output. */
numeric digits max(9,w+2) /*ensure enough digits to handle#*/
@. =0; @.1=2; !.=2; _=' 6'
!._=22; !.16=12; !.28=8; !.36=20; !.56=20; !.76=20; !.96=20
/* [↑] "Lucas' numbers, 1891. */
do i=low to high by 0 /*process the single # or range. */
if isPerfect(i) then say right(i,w) 'is a perfect number.'
|