Cryptographic number related function and algorithms