OFFSET
1,2
COMMENTS
Conjecture: 3n/2 - a(n) is in {0, 1/2, 1} for n >= 1.
Proof of the conjecture: Let t=A010060 be the Thue-Morse sequence. Every pair t(2n-1),t(2n) is either 01 or 10. Since 01 and 10 map to 110 and 101 under the transform, which both have length 3, it follows that a(2n+1) = 3n+1, and a(2n) = 3n if t(2n)=0, a(2n) = 3n-1 if t(2n)=1 for n=1,2,..., and so certainly 3n/2 - a(n) is 0, 1/2 or 1. - Michel Dekking, Jan 05 2018
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..10000
FORMULA
a(2n+1) = 3n+1, a(2n) = 3n - A010060(2n) - Michel Dekking, Jan 05 2018
a(n) = n+floor(n/2) if n is odd and a(n) = n+floor(n/2)-A010060(n-1) otherwise. - Chai Wah Wu, Nov 17 2024
EXAMPLE
As a word, A285952 = 110101101110101..., in which 1 is in positions 1,2,4,6,7,9,...
MATHEMATICA
s = Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {0}, 7] (* Thue-Morse, A010060 *)
w = StringJoin[Map[ToString, s]]
w1 = StringReplace[w, {"0" -> "1", "1" -> "10"}] (* A285952, word *)
st = ToCharacterCode[w1] - 48 (* A285952, sequence *)
Flatten[Position[st, 0]] (* A285953 *)
Flatten[Position[st, 1]] (* A285954 *)
PROG
(Python)
def A285954(n): return n+(n>>1)-(0 if n&1 else (n-1).bit_count()&1) # Chai Wah Wu, Nov 17 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 05 2017
STATUS
approved