Calculate number of divisor with formula total div = ( p1 + 1 ) * ( p2 + 1 ) * ... . . * ( pn + 1 ) where n = ( a1 ^ p1 ) * ( a2 ^ p2 ) . ... * ( an ^ pn ) ai being prime divisor for n and pi are their respective power in factorization
count = 0 NEW_LINE if ( n % P == 0 ) : NEW_LINE INDENT while ( n % P == 0 ) : NEW_LINE INDENT n = n // P NEW_LINE count += 1 NEW_LINE DEDENT total = total * ( count + 1 ) NEW_LINE DEDENT return total NEW_LINE