OFFSET
0,3
COMMENTS
This sequence is to factorial base what A004186 is to decimal base.
LINKS
FORMULA
a(a(n)) = a(n).
a(n) >= n with equality iff n belongs to A351987.
EXAMPLE
For n = 1664:
- the factorial base expansion of 1664 is "214110",
- arranging these digits in decreasing order gives "421110",
- so a(1664) = 4*6! + 2*5! + 1*4! + 1*3! + 1*2! + 0*1! = 3152.
MATHEMATICA
max = 5; b = MixedRadix[Range[max, 2, -1]]; a[n_] := FromDigits[Sort[IntegerDigits[n, b], Greater], b]; Array[a, max!, 0] (* Amiram Eldar, Feb 28 2022 *)
PROG
(PARI) a(n) = { my (dd=[]); for (r=2, oo, if (n==0, dd = vecsort(dd); return (sum(k=1, #dd, dd[k]*k!)), dd = concat(dd, n%r); n\=r)) }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 27 2022
STATUS
approved