Proper divisors: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added/changed comments and whitespace, used a template for the OUTPUTs, simplified the code, used better idiomatic code for handling C.L. input, cre-worked the integer square root code. |
m →version 3: updated the parameter parsing for the Pdivs function. |
||
Line 3,402: | Line 3,402: | ||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
Pdivs: procedure; parse arg x,b; x=abs(x); if x==1 then return '' |
Pdivs: procedure; parse arg x 1 z,b; x=abs(x); if x==1 then return '' /*unity?*/ |
||
odd=x // 2; if x==0 then return '∞' |
odd=x // 2; if x==0 then return '∞' /*zero ?*/ |
||
r=0 /* [↓] ══integer square root══ ___ */ |
r=0 /* [↓] ══integer square root══ ___ */ |
||
q=1; do while q<=z; q=q*4; end /*R: an integer which will be √ X */ |
q=1; do while q<=z; q=q*4; end /*R: an integer which will be √ X */ |