OFFSET
0,3
COMMENTS
LINKS
FORMULA
PROG
(Scheme, three versions. Some require Antti Karttunen's IntSeq-library)
;; This implements the given recurrence:
(definec (A275959 n) (cond ((zero? n) n) ((even? n) (A255411 (A153880 (A275959 (/ n 2))))) (else (+ 1 (A255411 (A153880 (A275959 (/ (- 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 a153880(n):
x=(str(a007623(n)) + '0')[::-1]
return 0 if n==0 else sum([int(x[i])*f(i + 1) for i in range(len(x))])
def a(n): return 0 if n==0 else a255411(a153880(a(n//2))) if n%2==0 else 1 + a255411(a153880(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 16 2016
STATUS
approved