# The program in the computer

An easy puzzle for beginners:

You are in front of a computer which, upon your input, will produce a sequence of numbers. Your task is to discover which logic was used to program the computer.

Sitting in front of the computer, you type: 7. The computer replies with the sequence: 5, 4, 4, 4, and then 4 all along.

Then you type 6. The computer replies with: 3, 5, 4, 4, 4, and then 4 all along.

Pensive, you type 42. Computer's reply: 8, 5, 4, 4, 4, and then 4 all along again.

You try different numbers, and notice that all sequences eventually go with 4 repeated endlessly.

What is the algorithm used?

Each sequence is generated by:

Taking the number of letters in the spelling of the last number

I.E.

7=S-E-V-E-N has 5 letters
5=F-I-V-E has 4 letters
4=F-O-U-R has 4 letters....

Also Note

Four is the only number that has the same number of letters as the number itself.

• You were so quick in answering. Kudos, and yes, there's a sierpinski triangle there :-) Commented Oct 11, 2015 at 19:27
• You beat me to it. Commented Oct 12, 2015 at 10:51
• I just happened to log on right after this question was posted. It's pretty rare for me to get first on one like this. Commented Oct 12, 2015 at 16:43