#K92522. Special Numbers Finder
Special Numbers Finder
Special Numbers Finder
Given a list of non-negative integers, your task is to identify the numbers that are "special". A number is called special if it is equal to the sum of the factorials of its digits. In mathematical terms, let a number \(n\) have digits \(d_1,d_2,\dots,d_k\); the number is special if:
\(n = \sum_{i=1}^{k} d_i!\)
For example, 145
is a special number because \(1! + 4! + 5! = 1 + 24 + 120 = 145\). If no special numbers exist in the given list, output None
.
inputFormat
The first line of input contains an integer \(N\) representing the number of integers. The second line contains \(N\) space-separated non-negative integers.
outputFormat
Output the special numbers found in the list in the order they appear, separated by a single space. If there are no special numbers, output None
.
4
1 2 145 407
1 2 145