another simple way to look at it is lowest number possible 0000 highest number possible 9,999 0000 to 9,999: thats 10,000 numbers > > I'm design an electronic for a 16f84 and I'm wondering > > what's the correct way to determine the total number of > > possible different combinations that could be input > > before finally obtaing the correct code. > > My keyboard has 10 digits ( 0 - 9 ) and I've chosen > > to have a 4 digit code to open the lock. I believe the > > correct way to determine the total combinations possible > > would be exactly 10000 ( i.e. 10^4 = 10000 ) but, I've > > been told the proper way to determine this is to use > > factorials ( i.e. 10! / 4! = 151200 ). > > So I guess there is a reason they make us EEs take discrete > probability... ignore the "advice". Your problem is one of the more simple > problems, I always think of it this way. You have 4 spots, and each spot you > can choose 10 different objects. So you have 10x10x10x10 possibilities, or > 10^4. The 10!/4! thing deals with something slightly different (it deals > with no repetition allowed, and it's still wrong, should have been 10!/6!), > from my Discrete Mathematics text: > > r-permutation Repetition not Allowed n!/(n-r)! > r-combination Repetition not Allowed n!/((n-r)!r!) (the lottery) > r-permutation Repetition Allowed n^r (what you wanted) > r-combination Repetition Allowed (n+r-1)!/((n-1)!r!) > (From Discrete Mathematics and Its Applications by Kenneth H. Rosen, 4th > Edition, Page 291) > > Hope this helped, TTYL