OFFSET
1,2
LINKS
FORMULA
PROG
(Scheme, different implementations)
(definec (A254115 n) (cond ((<= n 1) n) ((even? n) (* 2 (A254115 (/ n 2)))) (else (+ 1 (* 2 (A254104 (Ainv_of_A007310off0 (A003961 n))))))))
(define (Ainv_of_A007310off0 n) (+ (* 2 (floor->exact (/ n 6))) (/ (- (modulo n 6) 1) 4)))
(Python)
from sympy import factorint, nextprime
from operator import mul
def a048673(n):
f = factorint(n)
return 1 if n==1 else (1 + reduce(mul, [nextprime(i)**f[i] for i in f]))/2
def a254104(n):
if n==0: return 0
if n%3==0: return 1 + 2*a254104(2*n/3 - 1)
elif n%3==1: return 1 + 2*a254104(2*(n - 1)/3)
else: return 2*a254104((n - 2)/3 + 1)
def a(n): return a254104(a048673(n)) # Indranil Ghosh, Jun 06 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 04 2015
STATUS
approved