performance - Project Euler #5 php doubt! -


I got the solution but I do not know why this code is fast enough to code 14 The only difference is that I wrote it for a huge to end if

  if ($ num% 14 == 0 & amp; $ Num% 13 == 0 & amp; amp; amp; amp; amp; $ num% 12 == 0 & amp; amp; amp; Youtube.com/company.num % 10 == 0 & amp; amp; amp; amp; amp; $ num% 8 == 0 & amp; amp; amp; amp; amp; amp; amp; $ num% 7 ==0 and amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; $ num% 6 == 0 & amp; Amp; amp; amp; num = num% 5 == 0 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; num = 3 == 0 & amp; amp; amp; Youtube.com Amp; Amp; Amp; Amp; $ Num% 1 == 0) {$ notFound = 0; }  

Why is this second code slower than the first one? For It seems faster in other languages ​​???

  $ notFound = 0; ($ I = 14; $ i & gt; = 2 & amp; amp; เคจเคนीं; Found == 0; $ i -) {If ($ num% $ i! = 0) {$ notFound = 1; }}  

The second code sample is doing more than just the first, so I expect this to be slower In this situation, you find that whenever bad performance is offered, provides for better looseness and readability.


Comments