number theory utils