Skip to main content
6 events
when toggle format what by license comment
Jan 31, 2018 at 19:43 history edited gnovice CC BY-SA 3.0
added 224 characters in body
Jan 31, 2018 at 19:03 comment added Luis Mendo That's the spirit! You can also keep the faster-running version, but the byte count is that of the shorter
Jan 31, 2018 at 18:08 comment added gnovice @LuisMendo: Sure, why not? It already iterates once more than needed, what's another n^2 or so iterations gonna hurt! ;)
Jan 31, 2018 at 18:01 comment added Luis Mendo If I understand correctly, it doesn't hurt to iterate more times than necessary (at the cost of speed). So you can replace while any(i) by for m=M. Who cares if the code takes hours to run :-)
Jan 31, 2018 at 17:56 comment added Luis Mendo Nice! I like how you use cumsum to vectorize and avoid nnz(primes(...)
Jan 31, 2018 at 17:50 history answered gnovice CC BY-SA 3.0