Amicable pairs: Difference between revisions

Content deleted Content added
Not a robot (talk | contribs)
Add 8086 assembly
m →‎{{header|REXX}}: added highlighting to some REXX preambles.
Line 4,255: Line 4,255:
<br>also incorporates the search of amicable numbers into the generation of the sigmas of the integers.
<br>also incorporates the search of amicable numbers into the generation of the sigmas of the integers.


The optimization makes it about another &nbsp; '''30%''' &nbsp; faster when searching for amicable numbers up to one million.
The optimization makes it about <u>another</u> &nbsp; '''30%''' &nbsp; faster when searching for amicable numbers up to one million.
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/
Line 4,292: Line 4,292:
<br>computing the square of &nbsp; '''J''' &nbsp; to see if that value exceeds &nbsp; '''X''').
<br>computing the square of &nbsp; '''J''' &nbsp; to see if that value exceeds &nbsp; '''X''').


The optimization makes it about another &nbsp; '''20%''' &nbsp; faster when searching for amicable numbers up to one million.
The optimization makes it about <u>another</u> &nbsp; '''20%''' &nbsp; faster when searching for amicable numbers up to one million.
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/
Line 4,335: Line 4,335:
This method of coding has the disadvantage in that the code (logic) is less idiomatic and therefore less readable.
This method of coding has the disadvantage in that the code (logic) is less idiomatic and therefore less readable.


The optimization makes it about another &nbsp; '''15%''' &nbsp; faster when searching for amicable numbers up to one million.
The optimization makes it about <u>another</u> &nbsp; '''15%''' &nbsp; faster when searching for amicable numbers up to one million.
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
<lang rexx>/*REXX program calculates and displays all amicable pairs up to a given number. */
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/
parse arg H .; if H=='' | H=="," then H=20000 /*get optional arguments (high limit).*/