Hello, I was wondering if someone could help me with these two counting problems.
"There is a simple programming language known as TRIVIAL. In this language only the following 6 types of instructions are allowed:
a.) Input X, a natural number
b.) Go to step # -
c.) Set X := X + 1
d.) If X = 0, then go to step # -
e.) If > 0, then set X := X - 1
Suppose that a program must begin with the instruction Input X and end with the instruction Stop. How many different programs are there, written in the language TRIVIAL if the program is n steps long?"
Similar to the first, the next is: "Suppose that a TRIVIAL program can begin with one or more statements Input X, where X may be any letter of the alphabet; for example, we may begin with Input A and then following with Input B. Then we allow statements of the form A := A + 1, and if B > 0, then set B := B - 1, and so on, provided that A and B are input variables. If the program begins by reading in two variables A and B, then how many different trivial programs are there using n steps?"
In this one, need to take into account 26 letters and im assuming combinatorics.
Thanks for your help.
Under ordinary situations, it would just be 6! I am assuming?