Permutations And Combinations Question 227

Question: The number of n digit numbers which consists of the digits 1 and 2 only if each digit is to be used at least once, is equal to 510 then n is equal to

Solution:

Answer: 9