login
A hierarchical sequence (W2{2} according to the description in the attached file - see link).
41

%I #20 Nov 03 2018 12:32:45

%S 1,2,1,3,4,3,1,2,1,5,6,5,1,2,1,3,4,3,1,2,1,7,8,7,1,2,1,3,4,3,1,2,1,5,

%T 6,5,1,2,1,3,4,3,1,2,1,9,10,9,1,2,1,3,4,3,1,2,1,5,6,5,1,2,1,3,4,3,1,2,

%U 1,7,8,7,1,2,1,3,4,3,1,2,1,5,6,5,1,2,1,3,4,3,1,2,1,11,12,11,1,2,1,3,4,3

%N A hierarchical sequence (W2{2} according to the description in the attached file - see link).

%H Antti Karttunen, <a href="/A059126/b059126.txt">Table of n, a(n) for n = 0..12287</a>

%H J. Wallgren, <a href="/A059126/a059126.txt">Hierarchical sequences</a>

%F a(3n+1) = 2*A001511(1+n), a(3n) = a(3n+2) = a(3n+1) - 1. - _Antti Karttunen_, May 28 2017

%t Array[IntegerExponent[2 #, 2] /. k_ :> ({# - 1, #, # - 1} &[2 k]) &, 36] // Flatten (* _Michael De Vlieger_, Nov 02 2018 *)

%o (Scheme, with memoization-macro definec)

%o (definec (A059126 n) (cond ((zero? (modulo n 3)) (- (A059126 (+ 1 n)) 1)) ((= 1 (modulo n 3)) (* 2 (A001511 (/ (+ 2 n) 3)))) (else (- (A059126 (+ -1 n)) 1))))

%o ;; _Antti Karttunen_, May 28 2017

%Y Cf. A001511, A059127, A059128, A059129, A059132, A059133.

%K easy,nonn

%O 0,2

%A _Jonas Wallgren_, Jan 19 2001