OFFSET
0,3
LINKS
EXAMPLE
For n=23 whose factorial base representation is "321", when we replace each nonzero digit with 1, we get "111", the factorial base representation of 9, thus a(23) = 9.
From n=37 ("1201") we get "1101", thus a(37) = 31 as A007623(31) = 1101.
MATHEMATICA
a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; s = Min[#, 1]& /@ s; Total[s*Range[Length[s]]!]]; Array[a, 100, 0] (* Amiram Eldar, Feb 14 2024 *)
PROG
(Scheme)
;; Standalone program:
(define (A276008 n) (let loop ((n n) (s 0) (f 1) (i 2)) (if (zero? n) s (let ((d (modulo n i))) (if (zero? d) (loop (/ n i) s (* i f) (+ 1 i)) (loop (/ (- n d) i) (+ s f) (* i f) (+ 1 i)))))))
(Python)
from sympy import factorial as f
def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
def a(n):
x=str(a007623(n))
y="".join('1' if int(i)>0 else '0' for i in x)[::-1]
return sum([int(y[i])*f(i + 1) for i in range(len(y))])
print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 21 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 18 2016
STATUS
approved