Last active
          August 29, 2015 14:01 
        
      - 
      
- 
        Save philihp/276c356ed2bc2d4e7020 to your computer and use it in GitHub Desktop. 
Revisions
- 
        philihp revised this gist May 7, 2014 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,12 +8,9 @@ for n in xrange(1,100000000): i = random.randint(0,99999999) s = "{0:0>8}".format(i); a = {"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0} for c in list(s): a[c]+=1; if 4 in a.values(): good+=1; if n % 100000 == 0: 
- 
        philihp revised this gist May 7, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,8 +14,8 @@ a[c]+=1; else: a[c]=1; if 4 in a.values(): good+=1; if n % 100000 == 0: ratio = good/float(n) print "%%%.8f = %d / %d"%(ratio*100,good,n) 
- 
        philihp revised this gist May 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,4 @@ good+=1; if n % 100000 == 0: ratio = good/float(n) print "%%%.8f = %d / %d"%(ratio*100,good,n) 
- 
        philihp revised this gist May 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ a[c]+=1; else: a[c]=1; if 4 in a.values(): good+=1; if n % 100000 == 0: ratio = good/float(n) 
- 
        philihp created this gist May 7, 2014 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/usr/bin/python import random total = 0; good = 0; for n in xrange(1,100000000): i = random.randint(0,99999999) s = "{0:0>8}".format(i); a = {} for c in list(s): if c in a.keys(): a[c]+=1; else: a[c]=1; if max(a.values()) >= 4: good+=1; if n % 100000 == 0: ratio = good/float(n) print "%.4f = %d / %d"%(ratio,good,n)