# Problem in Counting - Number of Passwords

• B
• SamitC
In summary, passwords with 6 to 8 characters can be created with the method outlined in the book. Every password must have at least 1 digit.
SamitC
Problem: How many passwords can be created with 6 to 8 characters. Letter case does not matter. Every password must have at least 1 digit.

Approach taken in the solution in the book:
Passwords with 6 characters P6 = 36^6 − 26^6 = 1,867,866,560.
Similarly, we have P7 = 36^7 − 26^7 = 70,332,353,920
and P8 = 36^8 − 26^8 = 2,612,282,842,880.
So, Answer: P = P6 + P7 + P8 = 2,684,483,063,360

My approach:
(number of passwords possible with 6 characters) * (adding 7th an 8th characters including blank) - (number of passwords possible with 6 alpha) * (adding 7th an 8th alpha including blank)

36^6 * 37^2 - 26^6 * 27^2 = 2,754,815,417,280

The answers are different. Can you pls. help finding what did I miss?

I don't think blanks count as characters ... would your exercise (or your computer, for that matter) accept a ##1## plus six spaces as password ?
 ah, see what you mean with these blanks. But adding two blanks to 6 letters doesn't work...

One has ##36^8 + 36^7 + 36^6 - 26^8 - 26^7 - 26^6##, the other has ##36^6 * 37 * 37 - 26^6 * 27*27##

BvU said:
 ah, see what you mean with these blanks. But adding two blanks to 6 letters doesn't work...
That's actually okay. adding two blanks to a 6 letter password gives a 6 letter password, and we should count that.
The problem is adding blank+letter or letter+blank. only one of these cases produces a valid password.

SamitC and BvU
SamitC said:
Every password must have at least 1 digit.
 shoot, it gets counted in and then subtracted, my bad.

SamitC
willem2 said:
The problem is adding blank+letter or letter+blank. only one of these cases produces a valid password.

Can you pls. explain more on this? I did not understand the blank+letter or letter+blank concept.
As per my understanding, blank is nothing. So if two blanks remain anywhere in a 7 character word, it becomes a 5 character word. i.e. does not matter where blank remains but what matters is how many times we allow blanks. Pls. correct me if wrong.

SamitC said:
Can you pls. explain more on this? I did not understand the blank+letter or letter+blank concept.
As per my understanding, blank is nothing. So if two blanks remain anywhere in a 7 character word, it becomes a 5 character word. i.e. does not matter where blank remains but what matters is how many times we allow blanks. Pls. correct me if wrong.

It seems I can't use the blanks. If the last two digits are blank then it means 6 character password which is already counted. Now, 7th or 8th char being blank means the same thing - 7 character password.
Now I am asking to myself - can we solve this problem using the blanks as characters with additional logic?

SamitC said:
It seems I can't use the blanks. If the last two digits are blank then it means 6 character password which is already counted. Now, 7th or 8th char being blank means the same thing - 7 character password.
Now I am asking to myself - can we solve this problem using the blanks as characters with additional logic?
You will have to count the cases with 0, 1 and 2 blanks separately.
There's one combination with 2 blanks, 36 with 1 character + a blank, and 362 with 2 characters.
You will get 366(1 + 36 + 362) which is the same as with the other method.

SamitC and BvU
It's important to state that it doesn't matter what we think is a valid password. The OP asks about the book answer, so the only thing that counts is what the book thinks. Without more information from the book, one is fishing for a set of rules that will match the book calculations.

From the book calculations, a blank is not valid anywhere. It's just the total number of possibilities from {a..z,0..9} (= 366) minus the total number of all-non-digit possibilities from {a..z} (=266) That is for 6 character passwords. The final answer is the sum of the answers for 6, 7, and 8 character passwords, similarly defined.

Last edited:
Beg to differ. You would get 1 867 866 560 which is not the book answer

BvU said:
Beg to differ. You would get 1 867 866 560 which is not the book answer
That is the book answer for 6 characters. It is summed with the corresponding answers for 7 and 8 characters. So the book's approach and definition of what is a valid password seems clear. (After seeing your response, I added another line to post #9.)

SamitC said:
It seems I can't use the blanks. If the last two digits are blank then it means 6 character password which is already counted. Now, 7th or 8th char being blank means the same thing - 7 character password.
Now I am asking to myself - can we solve this problem using the blanks as characters with additional logic?
If you are allowing blanks, you would have to specify the rules you want to follow for a legitimate password with blanks. If you do not want to count trailing blanks the logic will change, but if you just want to allow a blank like any other non-digit character, then change all the book calculation 36's and 26's to 37 and 27, respectively:
6 characters = 376-276 = 2,178,305,920
7 characters = 377-277 = 84,471,523,930
8 characters = 378-278 = 3,230,049,917,440
Total of 6, 7, or 8 characters = 3,316,699,747,290

PS. I don't see why many password programs wouldn't use trailing blanks as part of the password.

## What is the problem in counting the number of passwords?

The problem in counting the number of passwords is that it requires a large amount of computational power and time to generate and test all possible combinations of characters for a given length. This makes it difficult to accurately determine the exact number of unique passwords that can be created.

## How do you calculate the number of possible passwords?

The number of possible passwords can be calculated using the formula n^r, where n is the number of possible characters and r is the length of the password. For example, if there are 26 letters in the alphabet and the password is 8 characters long, the number of possible passwords would be 26^8 = 208,827,064,576.

## Are longer passwords more secure than shorter ones?

Generally, longer passwords are considered more secure because they have a larger number of possible combinations, making them more difficult to guess or crack. However, the strength of a password also depends on the complexity and randomness of the characters used.

## Can two different passwords have the same number of possible combinations?

Yes, it is possible for two different passwords to have the same number of possible combinations. For example, a password with 4 characters from a set of 10 possible characters (e.g. 1234) would have the same number of combinations (10,000) as a password with 5 characters from a set of 8 possible characters (e.g. abcde).

## How do hackers attempt to crack passwords?

Hackers use a variety of methods to crack passwords, including brute force attacks, dictionary attacks, and social engineering. They may also use password cracking software that utilizes algorithms to guess passwords based on common patterns or frequently used words.

• Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
• Set Theory, Logic, Probability, Statistics
Replies
1
Views
1K
• Precalculus Mathematics Homework Help
Replies
9
Views
2K
• Calculus and Beyond Homework Help
Replies
2
Views
2K
• General Math
Replies
6
Views
9K
• Precalculus Mathematics Homework Help
Replies
3
Views
2K
Replies
11
Views
2K
• Calculus and Beyond Homework Help
Replies
9
Views
12K
• General Math
Replies
4
Views
9K
• Precalculus Mathematics Homework Help
Replies
8
Views
808