OFFSET
1,3
COMMENTS
Largest k such that S_af(k) > k is 1599999. That's why there are only five numbers such that S_af(m) = m. Proved by computer calculations.
If m has eight or more digits then S_af(m) < m. Proved directly.
EXAMPLE
For m = 620, S_af(620) = af(6)+af(2)+af(0) = 619+1+0 = 620.
MATHEMATICA
af[0] = 0; af[n_] := af[n] = n! - af[n - 1]; Select[Range[1000], Total[af /@ IntegerDigits[#]] == # &] (* Amiram Eldar, Jul 02 2020 *)
PROG
(C++)
#include <iostream>
using namespace std;
int S_af(int n) { const int af[]={0, 1, 1, 5, 19, 101, 619, 4421, 35899, 326981}; int s=0; while (n) {s+=af[n%10]; n/=10; } return s; }
int main() {int n=0; while(n<=1599999){if(n==S_af(n)){cout<<n<<endl; }n++; }}
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Andrzej Kukla, Jul 01 2020
STATUS
approved