Task. Splits into different multipliers This task is formulated very briefly. Given a natural number N. you need to find the number of ways to represent it as a product of pairwise different factors greater than 1. The format of the input data The first line contains a single natural number 2 < = N < = 10^12 . Output format Output a single number - the number of ways to represent the number N as a product of pairwise different factors greater than 1. Explanation for example. There are 7 different ways to represent the number 48 as a product (including a degenerate one) of pairwise different multipliers. 1: 48, 2 * 24, 3 * 16, 4 * 12, 6 *8, 2 * 3 * 8, 2 * 4 * 6.
def algorithm(n, start=2): if n == 1: return 1 else: ans = 0 for i in range(start, n + 1): if n % i == 0: ans += algorithm(n // i, i + 1) return ans num = int(input()) ans = algorithm(num) print(ans)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)