Ability to generate a list of 3-digit numbers from a pool of digits in Wolfram?

154 Views Asked by At

I am attempting to generate a list of all possible 3-digit numbers that can be made by the numbers 1, 3, 5, 6, 7 and 9. I believe Wolfram should have the ability to give me a list, however, I am not too sure as to what to type. Can anyone help me?

Note: I don't just need the number of 3-digit numbers that can be made, as a combination formula can easily give me the answer to the former. Thanks!

Also no repeated digits please.

2

There are 2 best solutions below

2
On BEST ANSWER

EDIT Okay, now that I'm not trying to type this on a phone keyboard where I can't see the whole thing at once,

Map[Fold[(#1*10+#2)&, 0, #]&, 
    Tuples[{1,3,5,6,7,9},3]]

Trying it on WolframAlpha appears to work.

UPDATE

Without repeated digits:

Map[Fold[(#1*10+#2)&, 0, #]&, 
    Permutations[{1,3,5,6,7,9},{3}]]

WolframAlpha link

2
On

I am assuming you want them to be unique, that is, you don't want results like $(9,9,9)$.

 numbers = {1,3,5,6,7,9}; 
 result = Permutations[numbers, {3}] 

Then you can do

    Length[result]

and see there are 120 of them.

Note: that this question is better suited for the Mathematica Stack Exchange, but they'd want to see your code / attempts.