Created
March 5, 2019 12:08
-
-
Save LunaticNeko/cf4ae3b4f5a2a68f057bc7c0740bcc17 to your computer and use it in GitHub Desktop.
Analyzes digit distribution of pi from a plaintext file.
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
with open('pi-billion.txt') as f: | |
f.read(2) | |
count = [0]*10 | |
while True: | |
s = f.read(1000000).strip() | |
if not s: | |
break | |
for c in s: | |
count[int(c)] += 1 | |
print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment