OFFSET
0,4
LINKS
FORMULA
a(n) <= n.
a(n) = A306605(n, n).
EXAMPLE
For n = 42:
- 42 = 4! + 3*3!,
- f_42(0) = 0, f_42(f_42(0)) = 0,
- f_42(1) = 0, f_42(f_42(0)) = 0,
- f_42(2) = 0, f_42(f_42(2)) = 0,
- f_42(3) = 3, f_42(f_42(3)) = 3,
- f_42(4) = 1, f_42(f_42(4)) = 0,
- f_42(k) = 0, f_42(f_42(k)) = 0 for any k > 4,
- hence a(42) = 3*3! = 18.
PROG
(PARI) a(n) = { my (f=[]); for (r=1, oo, f = concat(f, n%r); n \= r; if (n==0, return (sum(k=1, #f, f[1+f[k]]*(k-1)!)))) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 25 2019
STATUS
approved