06 December 2004

integer arithmetic

Here is a theorem of McEliece via Knuth that I find very nice. If f is a continuous function with the property that f x is integer implies x is integer then forall real x we have that floor (f x) = floor (f (floor x)). Some consequences are: (a) that (x+m)/n == (int(x)+m)/n (with C++-like notation) and (b) int(log(x)) == int(log(int(x))). The proof is a nice exercise ;)

No comments:

Post a Comment

Note: (1) You need to have third-party cookies enabled in order to comment on Blogger. (2) Better to copy your comment before hitting publish/preview. Blogger sometimes eats comments on the first try, but the second works. Crazy Blogger.