Nice! Even though this is implemented before, it is easy to read (and if you only need simple functions, downloading Sage is a bit of a overkill (there is an online version of Sage which I used a lot during my PhD though!)).<p>I like seeing simple implementations of things like this - inspiring for others thinking of similar things!