# Listing numbers with non-repeating digits

I tried to search this but could not find. Given a number of digits(the maximum being 0 to 9), how can I generate a list of all possible numbers without repeating the digits in each number? e.g. Given the digits 1,2 & 3 I should get 123, 132, 213. 231, 312, & 321. I want to generate such a list of digits with all digits from 0 to 9. Thanks. I am relatively new at Mathematica and am trying to learn.

The lists of digits of the numbers you are looking for are mere permutations of the digits $0,\,1,\,2\,\dotsc,9$. Permutations can provide you with these permutations; FromDigits turns them into numbers.

FromDigits /@ Permutations[Range[0,9]]


This simply ignores leading 0-digits. If you want only numbers with 10 true digits, you can use the following:

FromDigits /@ Drop[Permutations[Range[0, 9]], 9!]

• 0 can't be the first digit. – OkkesDulgerci Jul 13 '18 at 6:46
• Leading 0 digits are removed automatically. – Henrik Schumacher Jul 13 '18 at 6:58
• Or this Drop[FromDigits /@ Permutations[Range[0, 3]], 9!] – OkkesDulgerci Jul 14 '18 at 4:55
• @OkkesDulgerci Very good point. It's much faster. Thanks. – Henrik Schumacher Jul 15 '18 at 14:32