An elderly professor arrives home without his key and realizes he must use the keypad he had installed for this reason.
He is however not only habitually forgetful, but also extremely insecure. As such he has set up that each time he enters his house via the keypad (which he only does when he forgets his key) the combination will be changed before the next use.
The number changes as follows:
The first number is doubled and the 1's place of the double digit becomes the new first number.
The tens place is carried and added to the second number. Again the 1's digit of this number is the new second number.
The tens digit is added to the fourth number and the 1's digit of the this number is the new 4th number.
The third number is increased by 3 (if it goes over 10 the ten's digit is discarded).
Question 1:
A. If the code is 0123, what was it last time the professor forgot his key?
B. How many times has he forgotten his key?
Questions 2:
A. If the code is started with 1111 and it ended in 1 last time but now ends in 2, how many times has the professor forgotten his key.