Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
16
Task/Perfect-numbers/Chipmunk-Basic/perfect-numbers.basic
Normal file
16
Task/Perfect-numbers/Chipmunk-Basic/perfect-numbers.basic
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
100 sub isperfect(n)
|
||||
110 if (n < 2) or (n mod 2 = 1) then isperfect = false
|
||||
120 sum = 1
|
||||
130 for i = 2 to sqr(n)
|
||||
140 if n mod i = 0 then
|
||||
150 sum = sum+i
|
||||
160 q = int(n/i)
|
||||
170 if q > i then sum = sum+q
|
||||
180 endif
|
||||
190 next
|
||||
200 isperfect = n = sum
|
||||
210 end sub
|
||||
220 print "The first 4 perfect numbers are:"
|
||||
230 for i = 2 to 10000
|
||||
240 if isperfect(i) then print i;" ";
|
||||
250 next i
|
||||
Loading…
Add table
Add a link
Reference in a new issue