63 lines
1.4 KiB
Plaintext
63 lines
1.4 KiB
Plaintext
Function PermBig(x As Long, y As Long) As ULongint
|
|
Dim As Long i
|
|
Dim As Longint z = 1
|
|
For i = x - y + 1 To x
|
|
z = z * i
|
|
Next i
|
|
Return (z)
|
|
End Function
|
|
|
|
Function FactBig(x As Long) As ULongint
|
|
Dim As Long i
|
|
Dim As Longint z = 1
|
|
For i = 2 To x
|
|
z = z * i
|
|
Next i
|
|
Return (z)
|
|
End Function
|
|
|
|
Function CombBig(Byval x As Long, Byval y As Long) As Double
|
|
If y > x Then
|
|
Return (0)
|
|
Elseif x = y Then
|
|
Return (1)
|
|
Else
|
|
If x - y < y Then y = x - y
|
|
Return (PermBig(x, y) / FactBig(y))
|
|
End If
|
|
End Function
|
|
|
|
Dim As Long i, j
|
|
Print "-- Long Integer - Permutations - from 1 to 12"
|
|
For i = 1 To 12
|
|
For j = 1 To i
|
|
Print "P(" & i & "," & j & ")=" & Str(PermBig(i, j)) & " ";
|
|
Next j
|
|
Print ""
|
|
Next i
|
|
|
|
Print Chr(10) & "-- Float integer - Combinations from 10 to 60"
|
|
For i = 10 To 60 Step 10
|
|
For j = 1 To i Step i \ 5
|
|
Print "C(" & i & "," & j & ")=" & Str(CombBig(i, j)) & " ";
|
|
Next j
|
|
Print ""
|
|
Next i
|
|
|
|
Print Chr(10) & "-- Float integer - Permutations from 5000 to 15000"
|
|
For i = 5000 To 15000 Step 5000
|
|
For j = 10 To 50 Step 20
|
|
Print "P(" & i & "," & j & ")=" & Str(PermBig(i, j)) & " ";
|
|
Next j
|
|
Print ""
|
|
Next i
|
|
|
|
Print Chr(10) & "-- Float integer - Combinations from 200 to 1000"
|
|
For i = 200 To 1000 Step 200
|
|
For j = 20 To 100 Step 20
|
|
Print "C(" & i & "," & j & ")=" & Str(CombBig(i, j)) & " ";
|
|
Next j
|
|
Print ""
|
|
Next i
|
|
Sleep
|