Code lock combination calculator

10 digit code lock

Imagine you had a lock like this, with n digits total where you have to press d digits in no specific order to open the lock. How many digits d would make the safest combination / produce the most combinations, and how many combinations can be made with those d digits?

Must be between 1 and 20

Combinations

Digits d