Skip to content

Instantly share code, notes, and snippets.

@philihp
Forked from DuncanHills/fourkind.py
Created May 7, 2014 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philihp/9ba8941049703b44ae42 to your computer and use it in GitHub Desktop.
Save philihp/9ba8941049703b44ae42 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import random
total = 0;
good = 0;
for n in xrange(1,10**8):
s = "{0:0>8}".format(n);
a = {}
for c in list(s):
if c in a.keys():
a[c]+=1;
else:
a[c]=1;
if 4 in a.values():
good+=1;
print float(good)/float(10**8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment