Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#1-9

one = [3, 3, 5, 4, 4, 3, 5, 5, 4]
ones = sum(one)
#10-19
tens_19 = [3, 6, 6, 8, 8,7,7,9,8,8]
#20-99
tens_prefix = [6, 6, 5, 5, 5, 7, 6, 6] # 20, 30, .., 90
tens_99 = [(i*10 + ones) for i in tens_prefix]
#100-999
hundred_prefix = [(j+7) for j in one] # 100, 200, .., 900
hundred_999 = [(k*100 + sum(tens_99) + (99*3) + ones + sum(tens_19)) for k in
hundred_prefix]
#1000
thousand = 11
print(sum(hundred_999) + thousand + ones + sum(tens_19) + sum(tens_99))
print(ones+sum(tens_19)+sum(tens_99))
print(hundred_prefix)

You might also like