Jump to content

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 aboutover 1012% faster than the REXX version 2   (more so when specifying larger numbers).
 
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 while j<r -(r*r==x) /*divide by some integers up to √ X */
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*/
Cookies help us deliver our services. By using our services, you agree to our use of cookies.