cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A335961 Alternating factorions: 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 af(0) = 0 (base 10).

This page as a plain text file.
%I A335961 #16 Aug 13 2020 22:26:50
%S A335961 0,1,620,621,643
%N A335961 Alternating factorions: 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 af(0) = 0 (base 10).
%C A335961 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.
%C A335961 If m has eight or more digits then S_af(m) < m. Proved directly.
%e A335961 For m = 620, S_af(620) = af(6)+af(2)+af(0) = 619+1+0 = 620.
%t A335961 af[0] = 0; af[n_] := af[n] = n! - af[n - 1]; Select[Range[1000], Total[af /@ IntegerDigits[#]] == # &] (* _Amiram Eldar_, Jul 02 2020 *)
%o A335961 (C++)
%o A335961 #include <iostream>
%o A335961 using namespace std;
%o A335961 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;}
%o A335961 int main() {int n=0;while(n<=1599999){if(n==S_af(n)){cout<<n<<endl;}n++;}}
%Y A335961 Cf. A005165 (alternating factorial), A014080 (factorions).
%K A335961 nonn,base,fini,full
%O A335961 1,3
%A A335961 _Andrzej Kukla_, Jul 01 2020