Perfect Cube factors of a Number | Function that returns the count of factors that are perfect cube ; To store the count of number of times a prime number divides N ; To store the count of factors that are perfect cube ; Count number of 2 's that divides N ; Calculate ans according to above formula ; Check for all possible numbers that can divide it ; Loop to check the number of times prime number i divides it ; Calculate ans according to above formula ;  ; Given number ; Function call
def noofFactors ( N ) : NEW_LINE INDENT if N == 1 : NEW_LINE INDENT return 1 NEW_LINE DEDENT count = 0 NEW_LINE ans = 1 NEW_LINE while ( N % 2 == 0 ) : NEW_LINE INDENT count += 1 NEW_LINE N //= 2 NEW_LINE DEDENT ans *= ( ( count // 3 ) + 1 ) NEW_LINE i = 3 NEW_LINE while ( ( i * i ) <= N ) : NEW_LINE INDENT count = 0 NEW_LINE while ( N % i == 0 ) : NEW_LINE INDENT count += 1 NEW_LINE N //= i NEW_LINE DEDENT ans *= ( ( count // 3 ) + 1 ) NEW_LINE i += 2 NEW_LINE DEDENT DEDENT / * Return final count * / NEW_LINE INDENT return ans NEW_LINE DEDENT N = 216 NEW_LINE print ( noofFactors ( N ) ) NEW_LINE