Factorials and never ending cycles!
Jelly, 6 bytes
D!SµÐĿ
ÐĿ Repeat until the results are no longer unique. Collects all intermediate results.
D Convert from integer to decimal (list of digits)
! Factorial (each digit)
S Sum
Try it online!
I don't see any other way to make it shorter other than to do as told.
Specs
- Input:
132
(as command-line argument) - Output:
[132, 9, 362880, 81369, 403927, 367953, 368772, 51128, 40444, 97, 367920, 368649, 404670, 5810, 40442, 75, 5160, 842, 40346, 775, 10200, 6, 720, 5043, 151, 122, 5, 120, 4, 24, 26, 722, 5044, 169, 363601, 1454]
Python 2, 88 bytes
import math
f=lambda x,l=[]:l*(x in l)or f(sum(math.factorial(int(i))for i in`x`),l+[x])
Try it online!
05AB1E, 12 bytes
[DˆS!O©¯så#®
Try it online!
Explanation
[ # infinite loop
Dˆ # add a copy of current value to the global list (initialized as input)
S # split current number to digits
!O # calculate factorial of each and sum
© # save a copy in register
¯så# # if the current number is in the global list, exit loop
® # retrieve the value from the register for the next iteration
# implicitly output the global list