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!)
A104895 a(0)=0; thereafter a(2n) = -2*a(n), a(2n+1) = 2*a(n) - 1. 4
0, -1, -2, 1, -4, 3, 2, -3, -8, 7, 6, -7, 4, -5, -6, 5, -16, 15, 14, -15, 12, -13, -14, 13, 8, -9, -10, 9, -12, 11, 10, -11, -32, 31, 30, -31, 28, -29, -30, 29, 24, -25, -26, 25, -28, 27, 26, -27, 16, -17, -18, 17, -20, 19, 18, -19, -24, 23, 22, -23, 20, -21, -22, 21, -64, 63, 62, -63, 60, -61, -62, 61, 56, -57, -58, 57, -60, 59 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Columns of table in A104894 written in base 10.
Conjecture: the positions where 0, 1, 2, 3, ... appear are given by A048724; the positions where -1, -2, -3, ... appear are given by A065621.
LINKS
FORMULA
a(0) = 0 and for k>=0, 0<= j <2^k, a(2^k + j) = a(j) + 2^k if a(j)<0, a(2^k + j) = a(j) - 2^k if a(j)>=0.
Sum_{0 <= n <= 2^k - 1} a(n) = - 2^(k-1).
Sum_{0 <= n <= 2^k - 1} |a(n)| = 4^(k-1).
a(n) = -A065620(n). - M. F. Hasler, Apr 16 2018
MAPLE
f:=proc(n) option remember; if n=0 then RETURN(0); fi; if n mod 2 = 0 then RETURN(2*f(n/2)); else RETURN(-2*f((n-1)/2)-1); fi; end;
MATHEMATICA
a[0] = 0;
a[n_]:= a[n]= If[EvenQ[n], 2 a[n/2], -2 a[(n-1)/2] - 1];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 03 2018 *)
PROG
(Haskell)
import Data.List (transpose)
a104895 n = a104895_list !! n
a104895_list = 0 : concat (transpose [map (negate . (+ 1)) zs, tail zs])
where zs = map (* 2) a104895_list
-- Reinhard Zumkeller, Mar 26 2014
(Sage)
def a(n):
if (n==0): return 0
elif (mod(n, 2)==0): return 2*a(n/2)
else: return -2*a((n-1)/2) - 1
[a(n) for n in (0..100)] # G. C. Greubel, Jun 15 2021
CROSSREFS
The negative of entry A065620.
Sequence in context: A082497 A242364 A065620 * A103122 A214918 A328394
KEYWORD
sign,look,nice
AUTHOR
Philippe Deléham, Apr 24 2005
EXTENSIONS
Corrected by N. J. A. Sloane, Nov 05 2005
Edited by N. J. A. Sloane, Apr 25 2018
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 March 28 15:38 EDT 2024. Contains 371254 sequences. (Running on oeis4.)