login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A335767 Numbers m such that m = S_af(m) = af(d_1)+af(d_2)+...+af(d_k) where d_1 d_2 ... d_n is the decimal expansion of m and af(m) = m!-(m-1)!+(m-2)!+...1! (alternating factorial) with S_af(0) = 1. 0
1, 621, 643, 398804 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Largest k such that S_af(k) > k is 1599999. That's why there are only four 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.
LINKS
EXAMPLE
For m = 643, S_af(643) = af(6)+af(4)+af(3) = 619+19+5 = 643.
MATHEMATICA
af[0] = af[1] = 1; af[n_] := af[n] = n! - af[n - 1]; Select[Range[400000], Total[af /@ IntegerDigits[#]] == # &] (* Amiram Eldar, Jun 24 2020 *)
PROG
(C++)
#include <iostream>
using namespace std;
int S_af(int n) { const int af[]={1, 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=1; while(n<=1599999){if(n==S_af(n)){cout<<n<<endl; }n++; }}
CROSSREFS
Cf. A005165 (alternating factorial).
Sequence in context: A010031 A252527 A232422 * A189119 A203086 A251243
KEYWORD
nonn,base,fini,full
AUTHOR
Andrzej Kukla, Jun 24 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 06:07 EDT 2024. Contains 371918 sequences. (Running on oeis4.)