21 lines
494 B
Plaintext
21 lines
494 B
Plaintext
100 cls : rem 10 HOME for Applesoft BASIC
|
|
110 print "The pairs of amicable numbers below 20,000 are :"
|
|
120 print
|
|
130 size = 18500
|
|
140 for n = 1 to size
|
|
150 m = amicable(n)
|
|
160 if m > n and amicable(m) = n then
|
|
170 print using "#####";n;
|
|
180 print " and ";
|
|
190 print using "#####";m
|
|
200 endif
|
|
210 next
|
|
220 end
|
|
230 function amicable(nr)
|
|
240 suma = 1
|
|
250 for d = 2 to sqr(nr)
|
|
260 if nr mod d = 0 then suma = suma+d+nr/d
|
|
270 next
|
|
280 amicable = suma
|
|
290 end function
|