Problem 42615. Factorizing a number into a given number of factors
Given a positive integer, n, and another positive integer, b, return a matrix, M, of width b, with the following properties: (a) Each row is sorted in ascending order (b) the rows are unique (c) the product of the integers in each row equals n (d) the columns are sorted in ascending order, such that the primary sorting is based on the first column, secondary on the second column, etc. (e) M contains integer values only
Note: The number 1 is also considered a valid factor.
Example 1:
n = 30
b = 2
M = [ 1 30 ; 2 15 ; 3 10 ; 5 6 ]
Example 2:
n = 120
b = 3
M = [ 1 1 120 ; 1 2 60 ; 1 3 40 ; 1 4 30 ; 1 5 24 ; 1 6 20 ; 1 8 15 ; 1 10 12 ; 2 2 30 ; 2 3 20 ; 2 4 15 ; 2 5 12 ; 2 6 10 ; 3 4 10 ; 3 5 8 ; 4 5 6 ]
Solution Stats
Problem Comments
-
1 Comment
The hardest property is not described (but tested):
(f) There are no b integers with product n other than in the rows of M.
Solution Comments
Show commentsGroup

Physics
- 18 Problems
- 13 Finishers
- Mechanics 1
- jogging?
- Bouncing disk
- Energy of an object
- Kepler's Equation
- Mechanical Advantage of a Gear Train
- What gear ratio does the cyclist need?
- Bernoulli's Equation
- Juggling
- Find the jerk
- Determine if a four bar mechanism is of Grashof type
- center of mass
- Center of mass
- Elastic Collision 001: 1-D
- Calculate compression ratio of engine
- Distance of the centroids of the balls
- Calculate the height of an object dropped from the sky
- How Far Can You Throw Something?
Problem Recent Solvers24
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!