in reply to Re^3: Why is this code so much slower than the same algorithm in C?
in thread Why is this code so much slower than the same algorithm in C?
or justperl -le "do { $i += 20 } while( $i%3||$i%7||$i%11||$i%13||$i%16||$i%1 +7||$i%19 ); print $i" 77597520
perl -le "print 3*5*7*11*13*16*17*19"
Update: Replace 3 with 9 in both samples above to get the correct answer, as noted and further explained in the replies below.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Why is this code so much slower than the same algorithm in C? (2s)
by snowhare (Friar) on Dec 11, 2008 at 19:11 UTC | |
by tye (Sage) on Dec 12, 2008 at 03:31 UTC | |
|
Re^5: Why is this code so much slower than the same algorithm in C? (2s)
by tilly (Archbishop) on Dec 15, 2008 at 13:19 UTC | |
by tye (Sage) on Dec 16, 2008 at 02:55 UTC | |
by tilly (Archbishop) on Dec 16, 2008 at 17:42 UTC |