OFFSET
0,3
COMMENTS
LINKS
FORMULA
MATHEMATICA
Table[Total[Times @@@ Transpose@ {Map[# #! &, Range@ Length@ #], Reverse@ #}] &@ IntegerDigits[n, 2], {n, 64}] (* Michael De Vlieger, Aug 31 2016 *)
PROG
(Scheme)
;; This is a standalone program:
(define (A276091 n) (let loop ((n n) (s 0) (f 1) (i 2)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) s (* i f) (+ 1 i))) (else (loop (/ (- n 1) 2) (+ s (* (- i 1) f)) (* i f) (+ 1 i))))))
;; This implements one of the given recurrences:
(definec (A276091 n) (cond ((zero? n) n) ((even? n) (A255411 (A276091 (/ n 2)))) (else (+ 1 (A255411 (A276091 (/ (- n 1) 2)))))))
(definec (A276091 n) (cond ((zero? n) n) ((even? n) (A276340 (A276091 (/ n 2)))) (else (+ 1 (A276340 (A276091 (/ (- n 1) 2)))))))
(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 a255411(n):
x=(str(a007623(n)) + '0')
y="".join(str(int(i) + 1) if int(i)>0 else '0' for i in x)[::-1]
return 0 if n==0 else sum(int(y[i])*f(i + 1) for i in range(len(y)))
def a(n): return 0 if n==0 else a255411(a(n//2)) if n%2==0 else 1 + a255411(a((n - 1)//2))
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 20 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 19 2016
EXTENSIONS
Name changed (to emphasize the functional nature of the sequence) with the original definition moved to the comments by Antti Karttunen, Sep 01 2016
STATUS
approved