Anonymous user
Proper divisors: Difference between revisions
→version 3: optimized the Pdivs function.
m (→version 3: changed wording in the REXX section header for version 3.) |
(→version 3: optimized the Pdivs function.) |
||
Line 1,679:
===version 3===
This REXX version is
It accomplishes a faster speed by incorporating the calculation of an ''integer square root'' of an integer (without using any floating point arithmetic).
Line 1,709:
do while q>1; q=q%4; _=z-r-q; r=r%2; if _>=0 then do; z=_; r=r+q; end; end
a=1 /* [↓] use all or only odd #s. ___ */
do j=2+odd by 1+odd to
if x//j==0 then do; a=a j; b=x%j b; end /*if ÷, add both divisors to α&ß*/
end /*j*/ /* [↑] % is the REXX integer division*/
|