OFFSET
1,3
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
FORMULA
a(3n) = 2n, a(3n+1) = 2n+1, a(3n+2) = a(n+1).
a(n) = A126760(2n-1).
PROG
(Scheme, with memoization-macro definec)
(define (inv_for_A032766 n) (+ (* 2 (floor->exact (/ n 3))) (modulo n 3)))
(Python)
def a(n):
if n%3==0: return 2*n//3
elif n%3==1: return 2*(n - 1)//3 + 1
else: return a((n - 2)//3 + 1)
print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 06 2017
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jan 22 2015
STATUS
approved