Skip to content

Instantly share code, notes, and snippets.

@amckinley
Last active February 2, 2017 21:41
Show Gist options
  • Save amckinley/0ffae316a8b18f6266db62928aa882a4 to your computer and use it in GitHub Desktop.
Save amckinley/0ffae316a8b18f6266db62928aa882a4 to your computer and use it in GitHub Desktop.
import itertools
import string
def main():
alphabet = string.ascii_lowercase
for r in range(2, 6):
perms = len(list(itertools.permutations(alphabet, r)))
perms_with_reps = len(list(itertools.product(alphabet, repeat=r)))
combos = perms_with_reps - perms
# x= r(26*(n-1)) +r
ryan_x = (r * (26 * 25)) + r
print r, perms, perms_with_reps, combos, ryan_x
if __name__ == '__main__':
main()
'''
[amckinley src]$ python combos.py
2 650 676 26 1302
3 15600 17576 1976 1953
4 358800 456976 98176 2604
5 7893600 11881376 3987776 3255
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment