euler40
汚いな。
L = [9*(i+1)*10**i for i in xrange(10)] def nth(n): n = n-1 def idx_and_rest(n): for i, e in enumerate(L): n -= e if n < 0: return (i, e+n) i, rest = idx_and_rest(n) for j in xrange(10**i, 10**(i+1)): size = len(str(j)) if size > rest: return str(j)[rest] else: rest -= size print reduce(lambda n, x : n*int(x), [nth(10**i) for i in range(7)], 1)