Given the questions I see here, I'm guessing this will not be too difficult for this crowd - but, I'm math-challenged, so... All help much appreciated!
A) How can I find the total number of permutations of a string of n length, when each element in the string can be just one of 2 single-digit integers?
e.g.,
- string length = 3
- possible values = 0 or 1
permutations = 000, 001, 010, 011, 100, 101, 110, 111
So, what would be the formula for finding the above for, say, a string length of 5?
B) Is there a general formula that I could use in a similar way, but for more than 2 possible single-digit integers in each place, in a string of n length?
e.g.,
- String length = 3
- each place can be 0, 1, or 2
permutations = 000, 001, 002, 010, 011, 012, 020, 021, 022, 100, 101, 102, 110, 111, 112, 200, 201, 202, 210, 211, 212, 220, 221, 222
Thanks for any advice!
Two big hints.
First, do lots of experiments. Write out and count all the sequences of length 1, 2, 3 and 4 first with two digits, then with three. If you arrange things in numerical order (which you did in your examples) you won't miss any . You should be able to see patterns emerge.
You can probably do this - and be proud of yourself - even though you think of yourself as math challenged. I do this problem with ordinary third graders.
Second, and a little subtler. What would the answer to your problem be for strings of various lengths if you allowed yourself all the digits from $0$ to $9$? Then think about writing numbers in binary (base $2$), ternary (base $3$) or any other base.
(I do this part of the exercise with fourth and fifth graders.)