Archives for April 2010

Sieve of Eratosthenes

The Sieve of Eratosthenes, implemented lazily in Python def integers_from(start):     x = start     while 1:         yield x         x += 1 def filter_out_multiples(stream, f):     return (i for i in stream if i%f != 0) numbers = (i for i in integers_from(2)) while [...]

The Discoveries

I’ve been reading books on the subway too and from work. It is wonderful. I’ve been alternating between books of quality, and trashy scifi. I just finished my most recent “quality” book, and highly recommend it to all my fellow science nerds and enthusiasts. In The Discoveries, Alan Lightman has collected the most groundbreaking scientific [...]

Generate a random true boolean lisp statement

Just in case you want generate a random tautology, you can find python code to do so at: http://pastie.org/933675. It’s actually pretty sweet – it won’t generate all true statements, but it will generate all tautologies of a given depth. Also, it has some clever hacks that allow it to be random (instead of true) [...]

Biases in Curricula Design

In Mindstorms (the groundbreaking book, not the Lego set) Seymour Papert writes that part of what drives the mathematical curriculum is the technology available to students. As I see it, a major factor that determined what mathematics went into school math was what could be done in the setting of school classrooms with the primitive [...]