Amicable pairs: Difference between revisions
→{{header|ALGOL 68}}: Better search algorithm, as in e.g., the PLI-80 sample (but still using a table of divisor sums)
(Added Chipmunk Basic, Gambas, QBasic and True BASIC) |
(→{{header|ALGOL 68}}: Better search algorithm, as in e.g., the PLI-80 sample (but still using a table of divisor sums)) |
||
Line 611:
OD;
# find the amicable pairs up to 20 000 #
FOR p1 TO UPB pd sum - 1 DO
IF pd sum[ pd sum p1 ] = p1 THEN
print( ( whole( p1, -6 ), " and ", whole(
FI
OD
END
|