Source: https://artofproblemsolving.com/articles/files/SatoNT.pdf