Created
June 4, 2016 14:30
-
-
Save voddan/25f151f3ad33b07c6dc485f7a59262dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val n = 100 | |
val sumNumbers = Ring(n).sum() | |
println("In theory, the sum of numbers 0..${n - 1} is ${n * (n - 1) / 2}.") | |
println("Which is consistent with a practical result of $sumNumbers.\n") | |
BinaryBits(5).asSequence().filter {it.sum() == 2}.take(5).forEach { println(it) } | |
println("\npermutations of 3 elements:") | |
for(configuration in Permutations(3)) { | |
println(configuration) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment