0

How can you make this algorithm work faster

I know that you can simplify it by dividing only by prime numbers, when checking a number, but I'm not sure, how to make it in python. Have you any ideas how to do this, or how to simplify mu algorithms in other ways? https://code.sololearn.com/cdhtsOU97lBK/?ref=app

11th Oct 2018, 2:12 PM
Ilia Zhuravok
Ilia Zhuravok - avatar
2 odpowiedzi
+ 1
try doing both of these, they both worked for me: sq rt(n + 1) or sq rt(n) + 1
12th Oct 2018, 6:27 PM
lewis yang
lewis yang - avatar
0
thanks
13th Oct 2018, 6:24 AM
Ilia Zhuravok
Ilia Zhuravok - avatar