Project Euler #178: Step Numbers

  • + 0 comments

    My script gives correct output in IDLE but fails due to timeout for this problem. Any suggestion or help:

    i = input() x=10**10

    def prime(a3): n=a3+1 flag=0 count=2 for i in range(n): flag=0 while flag!=1: count=count+1 for i in range(2,count): if count%i==0: count=count+1 break else: continue flag=1 print count

    def fun(x,i): if i<10*x: print 0 elif i==10*x: print 1 elif i>10*x: a=i/10*x
    a1=str(int(a)) a2=list(a1) a3=len(a2)-1 prime(a3)

    fun(x, i)