login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 1

%I #8 Mar 31 2020 16:44:00

%S 1,2,-1,3,9,19,34,13,38,7,41,81,128,73,135,205,283,370,274,169,282,

%T 160,30,-105,37,185,341,506,332,149,340,140,-68,-283,-59,171,409,656,

%U 399,665,941,1227,1524,1216,897,1226,886,536,176,-192

%N 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 If a zero term were to arise, we would consider it to have 1 bit.

%e 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 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 Since a(3) = -1 is odd, we add #"1" = 1, #"10" = 2 and #"1" = 1, to get a(4) = -1 + 4 = 3.

%o (PARI) ({A332064_vec(N, a=1, s=-a)=vector(N, n, a-=(-1)^a*s+=exponent(a+!a)+1)})(50)

%Y Cf. A000120.

%Y Cf. A332063 for a variant where the number of bits is always added, ignoring the parity of a(n).

%K sign

%O 1,2

%A _M. F. Hasler_, Feb 27 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 02:28 EDT 2024. Contains 371917 sequences. (Running on oeis4.)