Created
October 17, 2016 01:43
-
-
Save ewmson/c0254d01482f57d488e1d9d0577eebf1 to your computer and use it in GitHub Desktop.
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
import math | |
def digit_to_char(digit): | |
if digit < 10: return chr(ord('0') + digit) | |
else: return chr(ord('a') + digit - 10) | |
def str_base(number,base): | |
if number < 0: | |
return '-' + str_base(-number,base) | |
else: | |
(d,m) = divmod(number,base) | |
if d: | |
return str_base(d,base) + digit_to_char(m) | |
else: | |
return digit_to_char(m) | |
l = [0,2] | |
for idx in range(2,10001): | |
N = idx | |
count = l[N-1] | |
b = N | |
for a in range(1,b+1): | |
if math.gcd(a,b) == 1: | |
count += 1 | |
l.append(count) | |
# all values are stored in l, now convert them into the proper base strings | |
p_list = [str_base(number=i, base=36) for i in l] | |
#print the list out with spaces between each number | |
print(' '.join(p_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment