# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a332064 Showing 1-1 of 1 %I A332064 #8 Mar 31 2020 16:44:00 %S A332064 1,2,-1,3,9,19,34,13,38,7,41,81,128,73,135,205,283,370,274,169,282, %T A332064 160,30,-105,37,185,341,506,332,149,340,140,-68,-283,-59,171,409,656, %U A332064 399,665,941,1227,1524,1216,897,1226,886,536,176,-192 %N A332064 a(1) = 1, a(n + 1) = a(n) -(-1)^a(n) Sum_{k = 1..n} floor(log_2(a(k)) + 1): depending on parity of a(n), add or subtract the total number of bits of (absolute values of) the terms so far. %C A332064 If a zero term were to arise, we would consider it to have 1 bit. %e A332064 After a(1) = 1, since it is odd, we add the total number of bits so far, to get a(2) = 1 + 1 = 2. %e A332064 After a(2) = 2, since it is even, we subtract the total number of (not necessarily nonzero) bits so far (#"1" = 1, #"10" = 2), to get a(3) = 2 - 3 = -1. %e A332064 Since a(3) = -1 is odd, we add #"1" = 1, #"10" = 2 and #"1" = 1, to get a(4) = -1 + 4 = 3. %o A332064 (PARI) ({A332064_vec(N, a=1, s=-a)=vector(N, n, a-=(-1)^a*s+=exponent(a+!a)+1)})(50) %Y A332064 Cf. A000120. %Y A332064 Cf. A332063 for a variant where the number of bits is always added, ignoring the parity of a(n). %K A332064 sign %O A332064 1,2 %A A332064 _M. F. Hasler_, Feb 27 2020 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE