Toggle navigation
Delta: Algorithms
Download
Documentation
Partners
Combinations without Repetition
Example: choosing numbers in a lottery. (Order does not matter.)
Preview of this algorithm
Variable
Ask for n with default 0
Output
Print text n = number of items per column
Variable
Ask for t with default 0
Output
Print text t = number of columns
Variable
Set x to 0
Variable
Set r to 1
Variable
Set z to 1
Structure
While x < t
Variable
Set y to n - x
Variable
Set w to t - x
Variable
Set r to r * y
Variable
Set z to z * w
Variable
Set x to x + 1
Structure
End
Variable
Set r to r / z
Output
Print variable r