4 kyu

Multiply to `n`

155 of 164tonylicoding

Description:

Task

Given a positive integer, n, return the number of possible ways such that k positive integers multiply to n. Order matters.

Examples

n = 24
k = 2
(1, 24), (2, 12), (3, 8), (4, 6), (6, 4), (8, 3), (12, 2), (24, 1) -> 8

n = 100
k = 1
100 -> 1

n = 20
k = 3
(1, 1, 20), (1, 2, 10), (1, 4, 5), (1, 5, 4), (1, 10, 2), (1, 20, 1),
(2, 1, 10), (2, 2, 5), (2, 5, 2), (2, 10, 1), (4, 1, 5), (4, 5, 1),
(5, 1, 4), (5, 2, 2), (5, 4, 1), (10, 1, 2), (10, 2, 1), (20, 1, 1) -> 18

Constraints 1 <= n <= 1_000_000_000_000 and 1 <= k <= 1_000

Mathematics
Algebra
Performance
Algorithms

Similar Kata:

More By Author:

Check out these other kata created by tonylicoding

Stats:

CreatedJul 22, 2020
PublishedJul 22, 2020
Warriors Trained2347
Total Skips110
Total Code Submissions2695
Total Times Completed164
Python Completions155
JavaScript Completions13
Total Stars138
% of votes with a positive feedback rating92% of 43
Total "Very Satisfied" Votes37
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes1
Total Rank Assessments5
Average Assessed Rank
4 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • tonylicoding Avatar
  • raulbc777 Avatar
  • dfhwze Avatar
Ad