Sort:  

Thanks! This is a pretty cool problem with an elegant solution. Pretty neat that it comes up with e in it as well!

Well I hate math...