Skip to content

Instantly share code, notes, and snippets.

@Scinawa
Last active March 24, 2016 16:17
Show Gist options
  • Save Scinawa/bfe3b060ba14f4a2fa9b to your computer and use it in GitHub Desktop.
Save Scinawa/bfe3b060ba14f4a2fa9b to your computer and use it in GitHub Desktop.
Injective functions from N to X, up to a permutation of N
import itertools
s="ABCD"
rep=3
a = [i for i in itertools.combinations(s, rep)]
len(a) == math.factorial(len(s)) / (math.factorial(rep) * math.factorial(len(s)-rep))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment