Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
For n = 2 To 10000 Step 2
|
||||
VerifyIfPerfect()
|
||||
If isPerfect = 1 Then
|
||||
TextWindow.WriteLine(n)
|
||||
EndIf
|
||||
EndFor
|
||||
|
||||
Sub VerifyIfPerfect
|
||||
s = 1
|
||||
sqrN = Math.SquareRoot(n)
|
||||
If Math.Remainder(n, 2) = 0 Then
|
||||
s = s + 2 + Math.Floor(n / 2)
|
||||
EndIf
|
||||
i = 3
|
||||
while i <= sqrN - 1
|
||||
If Math.Remainder(n, i) = 0 Then
|
||||
s = s + i + Math.Floor(n / i)
|
||||
EndIf
|
||||
i = i + 1
|
||||
EndWhile
|
||||
If i * i = n Then
|
||||
s = s + i
|
||||
EndIf
|
||||
If n = s Then
|
||||
isPerfect = 1
|
||||
Else
|
||||
isPerfect = 0
|
||||
EndIf
|
||||
EndSub
|
||||
Loading…
Add table
Add a link
Reference in a new issue