MATLAB Answers

how to get combination

1 view (last 30 days)
I am seeking a help.
Suppose I have a number like 100. How I can get possible combination for this number. It can make two matrix for combinations A=[100,50,25,20,10,5,4,2,1] B=[1,2,4,5,10,20,25,50,100] how i can solve for big number?

  1 Comment

Sign in to comment.

Accepted Answer

Rishabh Rathore
Rishabh Rathore on 1 Jun 2018
Here's what I understand from your question, you want all divisors of a number.
You can use in-built 'divisors()' function.
Refer divisors

  0 Comments

Sign in to comment.

More Answers (1)

Greg
Greg on 1 Jun 2018
Edited: Greg on 1 Jun 2018
If you have the Symbolic Math Toolbox, you can use the divisors function. Then it's a simple flip to get the opposite order.

  0 Comments

Sign in to comment.

Sign in to answer this question.