Anonymous user
Count in factors: Difference between revisions
m
→using integer SQRT: added/changed some comments, optimized the function.
m (→{{header|REXX}}: optimized the function, simplified some code, added/changed whitespace and comments.) |
m (→using integer SQRT: added/changed some comments, optimized the function.) |
||
Line 3,340:
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
factr: procedure; parse arg z 1 n,$; if z<2 then return z
do while z// 2==0; $= $'x2' ; z= z%2 ; end /*maybe add factor of 2 */
do while z// 3==0; $= $'x3' ; z= z%3 ; end /* " " " " 3 */
Line 3,353:
do while z//31==0; $= $'x31'; z= z%31; end /* " " " " 31 */
do while z//37==0; $= $'x37'; z= z%37; end /* " " " " 37 */
end▼
end /*while*/ /* [↑] find integer SQRT(z). */
do j=41 by 6 to r while j<=z /*insure J isn't divisible by 3*/
parse var j '' -1 _ /*get last decimal digit of J.*/
|