I am writing a program using iterations, but I have next to none math skills. My explanation will be lacking keywords and definitions so please excuse that, but my question is as follows:
I am generating iterations and using them, it's a mix of entries, let's say "$A$" and "$B$", Where $AB != BA$ - with repetition $2$ the complete list looks like this: $AA$, $AB$, $BA$, $BB$.
Now, I would like to know how long my iteration will be in total if I still had "$A$" and "$B$", but $5$ repetitions with an output looking like this $AAABA$ eg.
How do I go about calculating $X$ entries and $Y$ repetitions?
I dunno if I should just have paid more attention in high school and this is a stupidly easy question, but if you take the time to help it would help a hobby programmer greatly!
(sry for the tags if they are all wrong, I don't know what any of them mean)
Fast answer:
$$\text{number of items}^{\text{number of spaces}}$$
for example, in 5 repetitions and entry $A,B$, the number of spaces is 5 and number of items is 2
Also, if your program has a part like:
Then you can do:
The math behind is like this:
You have $X$ items, and you have $Y$ slots, then in the first of slot how many options do you have to put one item? Of course, you have $X$ options.
Then for the second slot, you ask how many items can be in that slot? Of course, the answer is again $X$.
Since you have $y$ slots, and in everyone of them you can put $X$ items, you will have a total of combinatios of :
$$X\times X\times X\times \cdots X$$
How many times? The number of slots that you have, it is $Y$
So the number of combinatios are $$\underbrace{X\times X\times X\times \cdots X}_{Y \text{times}} = X^Y$$