Data update
This commit is contained in:
parent
07c7092a52
commit
61b93a2cd1
313 changed files with 6160 additions and 346 deletions
20
Task/Amicable-pairs/Chipmunk-Basic/amicable-pairs.basic
Normal file
20
Task/Amicable-pairs/Chipmunk-Basic/amicable-pairs.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue