Home > Blockchain >  Working out the combination time of a four digit pin
Working out the combination time of a four digit pin

Time:04-03

I'm trying to get my head around the timing of working out combinations. For example, if I have a single digit combination that takes 1 second to check all potential combinations, that's 10 possible digits (10^1). But then based on that how would I go about finding out how long it takes to work out a 4 digit combination?

I understand that 10^4 = 10000 possible combinations but I'm having trouble understanding how to calculate the time. If one digit takes 1 second then 2 digits would take 100 seconds? As 10^2 = 100 * 1.

I'd appreciate any tips you can give me.

Edit: each of the four digits can be in the range 0-9 and can repeat, i.e. [0-9] [0-9] [0-9] [0-9]

CodePudding user response:

If, the combination of 10 numbers, choosing 1, always takes 1 second, for combination of 10, choosing 2, will be 55 possibilities, so, the time will be 55/10, about 5.5 seconds. For combination of 10 choosing 4, you'll have 210 possibilities, so, based on this logic, it will take 21 seconds to check all of them. Also, i think, for calculating combinations, it's better to use this formula enter image description here

If i missed something, please edit the question to add more details

CodePudding user response:

If 1 digit takes 1 second, that means that 10 cases (0-9) take 1 second in total.

If you have 4 digits, that's 10 000 cases. Knowing that 10 cases take 1 second, we have

(10 000 / 10) * 1 second = 1 000 seconds.

  • Related