[Tutor] List comprehension question

Richard D. Moores rdmoores at gmail.com
Tue Nov 9 08:49:44 CET 2010


On Mon, Nov 8, 2010 at 22:47, Richard D. Moores <rdmoores at gmail.com> wrote:
> On Mon, Nov 8, 2010 at 21:31, Richard D. Moores <rdmoores at gmail.com> wrote:
>
>> That sqrt(n) works for speeding up the finding of primes, but here we
>> want to use int(n/2) (and why didn't I think of that?), which results
>> in about a 2x speedup. See <http://tutoree7.pastebin.com/dyRC8vuX>.
>
> NO! Use  int(n/2)+1 .  I'll correct that in
> <http://tutoree7.pastebin.com/dyRC8vuX> and report back.

See <http://tutoree7.pastebin.com/eZPaVpwG>

But now I'll have to redo again using Stefan's ingenious suggestion.

Dick


More information about the Tutor mailing list