We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #178: Step Numbers
Project Euler #178: Step Numbers
Sort by
recency
|
13 Discussions
|
Please Login in order to post a comment
What wrong in this Code?
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)
I submitted my solution. it works fine on my machine. Runtime errors shown on your results. why is that?
when do we get solutions of the problem?
Instead of traversing around all numbers , try to find the pattern for 10^n. Use recusrion if required :)