[go: up one dir, main page]

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!)
A368595 Alternating sum of A006519. 1
-1, 1, 0, 4, 3, 5, 4, 12, 11, 13, 12, 16, 15, 17, 16, 32, 31, 33, 32, 36, 35, 37, 36, 44, 43, 45, 44, 48, 47, 49, 48, 80, 79, 81, 80, 84, 83, 85, 84, 92, 91, 93, 92, 96, 95, 97, 96, 112, 111, 113, 112, 116, 115, 117, 116, 124, 123, 125, 124, 128, 127, 129, 128 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
a(n) <= (n/2)*log_2 n, with equality at powers of 2.
LINKS
FORMULA
a(n) = Sum_{i=1..n} (-1)^i*A006519(i).
a(n) = A136013(n) - (n mod 2). - Kevin Ryde, Jan 01 2024
MATHEMATICA
a[1]=-1; a[n_]:=If[OddQ[n], a[n-1]-2^IntegerExponent[n, 2], a[n-1]+2^IntegerExponent[n, 2]]; Table[a[n], {n, 63}] (* James C. McMahon, Dec 31 2023 *)
PROG
(PARI) a(n) = fromdigits(Vec(Pol(binary(n))'), 2) - bitand(n, 1); \\ Kevin Ryde, Jan 01 2024
(Python)
def A368595(n): return sum(map(lambda x:(x[0]+1)*(1<<x[0]), filter(lambda x:x[1]=='1', enumerate(bin(n)[-2:1:-1]))))-(n&1) # Chai Wah Wu, Jan 01 2024
CROSSREFS
Cf. A006519. A006520 (all positive signs), A136013.
Cf. A093347 (with powers of 3).
Sequence in context: A134186 A024688 A024477 * A270649 A049008 A280023
KEYWORD
sign,easy
AUTHOR
Jeffrey Shallit, Dec 31 2023
STATUS
approved

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 August 29 03:06 EDT 2024. Contains 375510 sequences. (Running on oeis4.)