https://blog.plover.com/math/PM.html