OFFSET
1,1
REFERENCES
M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 101.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Joerg Arndt, Table of n, a(n) for n = 1..1000
Joerg Arndt, Matters Computational (The Fxtbook), p. 58-59
Eric Weisstein's World of Mathematics, Negabinary
A. Wilks, Email, May 22 1991
FORMULA
a(n) = A005351(-n). - Reinhard Zumkeller, Feb 05 2014
EXAMPLE
a(4) = 12 because the negabinary representation of -4 is 1100, and in ordinary binary that is 12.
a(5) = 15 because the negabinary representation of -5 is 1111, and in binary that is 15.
MATHEMATICA
(* This function comes from the Weisstein page *)
Negabinary[n_Integer] := Module[{t = (2/3)(4^Floor[Log[4, Abs[n] + 1] + 2] - 1)}, IntegerDigits[BitXor[n + t, t], 2]];
Table[FromDigits[Negabinary[n], 2], {n, -1, -50, -1}]
(* Alonso del Arte, Apr 04 2011 *)
PROG
(Haskell)
a005352 = a005351 . negate -- Reinhard Zumkeller, Feb 05 2014
(PARI) a(n) = my(t=(32*4^logint(n+1, 4)-2)/3); bitxor(t-n, t); \\ Ruud H.G. van Tol, Oct 19 2023
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved