r/programbattles • u/Parzival_Watts • Oct 08 '15
Any language [Any Language] Tweetable Code
Open ended challenge!
Write some code in any language that does something interesting. The only restriction is that it must fit inside a tweet (140 characters or less)
28
Upvotes
View all comments
Show parent comment
2
u/Fiqqqhul Oct 09 '15
Huh... Learn something new every day.
Sure enough, the multiplication is slower. I wonder if it is optimizing the sqrt(n). Because n does not change in the loop sqrt(n) only needs to be calculated once, while i*i needs to be calculated every time the loop goes around. I don't know if the JS engines are that smart.