[VB6] Permutation Counter
Credits: falzarex
Creator: stonie & falzarex
What is permutation?
The number of possible combinations of a given set of numbers in which each permutation is unique.
What does this code do?
Tells you the permutation of any givin length up to 170.
Basically allows you to input a value and the number of permutations calculated will be returned.
Up to 17 is redable data. Anything over returns E+. Max VB allows is 170.
Permutation Function
Code:
Private Function Permutation(Value As Long) As String
On Error Resume Next
Dim n As Long, S As Long
n = 1
For S = 1 To Value
n = n * (S + 1 \ 2)
Next S
Permutation = CStr(n)
Err.Clear
End Function
Example of usage
Code:
Label1 = Permutation(Val(Text1.Text))