## Factorial Sum List

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 16M

Problem type

Start with any number, say . Find the sum of the factorial ( factorial by convention) of each of the digits of . Repeat this procedure (in this case you will get ). Continue summing the factorials of individual digits until your list repeats a number. For example for you will get the following list:
25 122 5 120 4 24 26 722 5044 169 363601 1454 169 At this point you got a repetition (), so your list will repeat forever and you'd might as well stop now. Your list has elements.

Write a program that asks the user to enter any number from to and computes the FACTORIAL SUM LIST until a duplicate number is found. The output for your program should be the length of your list.

#### Input Specification

Integer numbers, one per line. The end of data is signaled by the number 0.

#### Output Specification

The length of the FACTORIAL SUM LIST for each number in the input file.

#### Sample Input

25
0

#### Sample Output

13