login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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
1, 2, -1, 3, 9, 19, 34, 13, 38, 7, 41, 81, 128, 73, 135, 205, 283, 370, 274, 169, 282, 160, 30, -105, 37, 185, 341, 506, 332, 149, 340, 140, -68, -283, -59, 171, 409, 656, 399, 665, 941, 1227, 1524, 1216, 897, 1226, 886, 536, 176, -192 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

If a zero term were to arise, we would consider it to have 1 bit.

LINKS

Table of n, a(n) for n=1..50.

EXAMPLE

After a(1) = 1, since it is odd, we add the total number of bits so far, to get a(2) = 1 + 1 = 2.

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.

Since a(3) = -1 is odd, we add #"1" = 1, #"10" = 2 and #"1" = 1, to get a(4) = -1 + 4 = 3.

PROG

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

CROSSREFS

Cf. A000120.

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

Sequence in context: A126009 A301282 A246063 * A229417 A332058 A260758

Adjacent sequences:  A332061 A332062 A332063 * A332065 A332067 A332070

KEYWORD

sign

AUTHOR

M. F. Hasler, Feb 27 2020

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 15 23:32 EDT 2020. Contains 335774 sequences. (Running on oeis4.)