OFFSET
1,3
COMMENTS
Null values are at n = 1, 2, 145, 40585 (A014080). Twin values are at n = 1, 2; 11, 12; 21, 22; ... 10*i + 1, 10*i + 2. Not in sequence: 7, 10, 14, ... Nice polar diagrams repeating themselves with normalized angle to 9! and radius = a(n).
The sequence can be seen as the difference between the natural numbers in the decimal system (n_dec = N0*(10^0) + N1*(10^1) + N2*(10^2)...) and their values in a non-positional number system based on the factorials of the digits (n_fact = N0*(N0 - 1)! + N1*(N1 - 1)! + N2*(N2 - 1)! ...). See also A111095. Note that a(np) - a(n) is congruent to 0 mod 9 if n and np are different for the permutation of the digits. Example (a(5971) - a(1957))/9 = 446. The property can be easily derived by remembering that np - n is congruent to 0 mod 9. - Giorgio Balzarotti, Oct 15 2005
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = n - (N0! + N1! + N2! + ...) if n = N0*10^0 + N1*10^1 + N2*10^2 ...
a(n) = n - A061602(n). - Michel Marcus, Apr 21 2014
EXAMPLE
For n = 35, a(35) = -91 because 35 - (3! + 5!) = 35 - (6 + 120) = -91.
MAPLE
seq(n-add((trunc(n/(10^j)) mod 10)!, j=0..length(n)-1), n=1..53);
# second Maple program:
a:= n-> n-add(i!, i=convert(n, base, 10)):
seq(a(n), n=1..100); # Alois P. Heinz, Oct 24 2018
MATHEMATICA
f[n_] := n - Plus @@ Factorial /@ IntegerDigits[n]; Table[f[n], {n, 53}] (* Ray Chandler, Jul 24 2005 *)
PROG
(PARI) a(n) = my(d = digits(n)); n - sum(i=1, #d, d[i]!); \\ Michel Marcus, Apr 21 2014
(Magma) [n-&+[Factorial(d): d in Intseq(n)]: n in [1..60]]; // Bruno Berselli, Oct 25 2018
CROSSREFS
KEYWORD
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jul 18 2005
EXTENSIONS
Extended by Ray Chandler, Jul 24 2005
STATUS
approved