Problem in Counting - Number of Passwords

  • Context: High School 
  • Thread starter Thread starter SamitC
  • Start date Start date
  • Tags Tags
    Counting
Click For Summary
SUMMARY

The forum discussion centers on calculating the number of valid passwords that can be created with 6 to 8 characters, where each password must include at least one digit and letter case does not matter. The book's calculations yield 2,684,483,063,360 valid passwords, derived from the formulas P6 = 36^6 − 26^6, P7 = 36^7 − 26^7, and P8 = 36^8 − 26^8. A user proposed an alternative approach resulting in 2,754,815,417,280, leading to confusion regarding the treatment of blanks in password formation. The consensus indicates that blanks should not be counted as valid characters in the final password count.

PREREQUISITES
  • Understanding of combinatorial mathematics
  • Familiarity with password complexity requirements
  • Knowledge of character sets (e.g., alphanumeric characters)
  • Basic understanding of mathematical notation (exponents)
NEXT STEPS
  • Research combinatorial counting techniques in password generation
  • Learn about password security best practices and complexity rules
  • Explore variations in password policies across different systems
  • Investigate the implications of including special characters and blanks in passwords
USEFUL FOR

Mathematicians, cybersecurity professionals, software developers, and anyone involved in password policy formulation or analysis.

SamitC
Messages
36
Reaction score
0
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?
 
Physics news on Phys.org
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 ?
[edit] 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:
[edit] 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.
 
  • Like
Likes   Reactions: SamitC and BvU
SamitC said:
Every password must have at least 1 digit.
[edit] shoot, it gets counted in and then subtracted, my bad.
 
  • Like
Likes   Reactions: 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.
 
  • Like
Likes   Reactions: 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:
  • #10
Beg to differ. You would get 1 867 866 560 which is not the book answer
 
  • #11
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.)
 
  • #12
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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
873
Replies
2
Views
2K
Replies
6
Views
10K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 9 ·
Replies
9
Views
13K
  • · Replies 4 ·
Replies
4
Views
2K