Given an integer N, count how many ways it can be expressed as a product of M integers > 1.
Input is simply N and M, and output is the total count of distinct integer groups. Meaning you can use an integer more than once, but each group must be distinct (3 x 2 x 2
would not count if 2 x 2 x 3
is present).
Constraints
1 < N < 231
1 < M < 30
Examples
Input 30 2
gives output 3
, since it can be expressed 3 ways:
2 x 15
3 x 10
5 x 6
Input 16 3
gives output 1
, since there's only one distinct group:
2 x 2 x 4
Input 2310 4
gives output 10
:
5 x 6 x 7 x 11
3 x 7 x 10 x 11
3 x 5 x 11 x 14
3 x 5 x 7 x 22
2 x 7 x 11 x 15
2 x 5 x 11 x 21
2 x 5 x 7 x 33
2 x 3 x 11 x 35
2 x 3 x 7 x 55
2 x 3 x 5 x 77
Input 15 4
gives output 0
, since it cannot be done.
Rules
Standard code golf loopholes apply, along with standard definitions for input/output. Answers may be a function or full program. Built-in functions for factorization and/or partitioning are not allowed, but others are fine. Code is counted in bytes.