Project Euler 63(python 0.000632)
#-*- coding:utf-8 -*- import math from datetime import datetime def Euler63(): count = 0 dim = 1 while (math.log10(9 ** dim) < dim) & (math.log10(9 ** dim) >= (dim -1)): for i in xrange(1,10): if (math.log10(i ** dim) < dim) & (math.log10(i ** dim) >= dim - 1): count += 1 dim += 1 return count def main(): start = datetime.now() answer = Euler63() end = datetime.now() print end - start, answer if __name__ == "__main__": main()