Math in Software Engineering / Computer Science degree

WBahn

Joined Mar 31, 2012
30,062
combinations are all exponential. A password is the same as a combination lock with wheels. How many digits on each wheel, how many wheels.

Example: 3 wheels, each with 0-9. that's 10 digits on 3 wheels. combinations: 10^3
Example: 5 wheels, 26 digits: 26^5
Combinations are NOT all exponential. The very first problem he was given illustrates that. It is a straight up permutation problem, which is factorial.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Combinations are NOT all exponential. The very first problem he was given illustrates that. It is a straight up permutation problem, which is factorial.
Factors are numbers and/or literals that are multiplied- which is what exponents are.

His first example is easily answered:

5 characters (aka wheels), 5 distinct values for each wheel (B, D, M, P, Y). That is 5^5. or 3,125 combinations. You are welcome to get your pencil and paper and start with BBBBB, then BBBBD, then BBBBM, until you get to YYYYY, and count them.

Am I misunderstanding the poster's example?
 

WBahn

Joined Mar 31, 2012
30,062
And after you list all 3,125 possible combinations in which you do not require that the five characters all be distinct (i.e., recognizably different), start crossing off all of the ones in which they aren't and you are left with 120 survivors.

Consider the following: I have three dogs in the room and the breeds are all distinct. That precludes having two german shepherds and a dachshund.

So you have 5 choices for the first character, but only four for the second, otherwise the first and second characters will not be distinct. Similarly, you have 3 options for the third, 2 for the fourth, and the fifth is completely dictated by the other four.

Hence there are 5! = 120 possible passwords.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Um, no, there are 3,125 unique combinations. Not one of them matches another. Your 120 is woefully shy of reality.

To help you, I've written a program to demonstrate it:
Code:
<?php

$wheelA = array(0 => 'B','D','M','P','Y');
$lineNum = 0;

for($j=0;$j<count($wheelA);$j++)
    {
    for($k=0;$k<count($wheelA);$k++)
        {
        for($l=0;$l<count($wheelA);$l++)
            {
            for($m=0;$m<count($wheelA);$m++)
                {
                for($n=0;$n<count($wheelA);$n++)
                    {
                    echo(sprintf("%'.04d",$lineNum++) . "\t" . $wheelA[$j] . $wheelA[$k] . $wheelA[$l] . $wheelA[$m] . $wheelA[$n] . "\n");
                    };
                };
            };
        };
    };
?>
Output as follows:
Code:
0000    BBBBB
0001    BBBBD
0002    BBBBM
0003    BBBBP
0004    BBBBY
0005    BBBDB
0006    BBBDD
0007    BBBDM
0008    BBBDP
0009    BBBDY
0010    BBBMB
...
3113    YYYMP
3114    YYYMY
3115    YYYPB
3116    YYYPD
3117    YYYPM
3118    YYYPP
3119    YYYPY
3120    YYYYB
3121    YYYYD
3122    YYYYM
3123    YYYYP
3124    YYYYY
There are 3,125 (starting at 0) unique combinations. In review the TP, whether your solution is correct, or mine, depends on how you interpret this phrase:

➢ the 5 characters are all distinct

You are interpreting it one way, I am interpreting it another.
 
Last edited:

WBahn

Joined Mar 31, 2012
30,062
There are 3,125 (starting at 0) unique combinations. In review the TP, whether your solution is correct, or mine, depends on how you interpret this phrase:

➢ the 5 characters are all distinct

You are interpreting it one way, I am interpreting it another.
Then, in your interpretation, what is the difference between these two problems:

Problem #1
You only remember:
➢ the 5 characters are B, D, M, P, Y
If you want to try all possible combinations, how many of them in total?

Problem #2
You only remember:
➢ the 5 characters are all distinct
➢ the 5 characters are B, D, M, P, Y
If you want to try all possible combinations, how many of them in total?

Notice that it isn't saying that the combinations are all distinct. It says that what you remember about the combination that you have forgotten is that the five characters in it are all distinct.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Then, in your interpretation, what is the difference between these two problems:

Problem #1
You only remember:
➢ the 5 characters are B, D, M, P, Y
If you want to try all possible combinations, how many of them in total?

Problem #2
You only remember:
➢ the 5 characters are all distinct
➢ the 5 characters are B, D, M, P, Y
If you want to try all possible combinations, how many of them in total?

Notice that it isn't saying that the combinations are all distinct. It says that what you remember about the combination that you have forgotten is that the five characters in it are all distinct.
@WBahn No, I concede and understand your point. I read his initial post another way, and could see him leaning either way depending on his meaning of 'distinct'.
 
Top