login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Today, Nov 11 2014, is the 4th anniversary of the launch of the new OEIS web site. 70,000 sequences have been added in these four years, all edited by volunteers. Please make a donation (tax deductible in the US) to help keep the OEIS running.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A039724 Numbers in base -2. 15
0, 1, 110, 111, 100, 101, 11010, 11011, 11000, 11001, 11110, 11111, 11100, 11101, 10010, 10011, 10000, 10001, 10110, 10111, 10100, 10101, 1101010, 1101011, 1101000, 1101001, 1101110, 1101111, 1101100, 1101101, 1100010, 1100011, 1100000, 1100001, 1100110, 1100111, 1100100 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

REFERENCES

M. Gardner, Knotted Doughnuts and Other Mathematical Entertainments. Freeman, NY, 1986, p. 101.

D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.

LINKS

William A. Tedeschi, Table of n, a(n) for n=0..10000

Joerg Arndt, Matters Computational (The Fxtbook), p. 58-59

Matthew Szudzik, A Mathematica programming contest

Eric Weisstein, Negabinary (MathWorld)

Wikipedia, Negative base

EXAMPLE

2 = 4+(-2)+0 = 110, 3 = 4+(-2)+1 = 111, ..., 6 = (16)+(-8)+0+(-2)+0 = 11010.

MATHEMATICA

ToNegaBases[ i_Integer, b_Integer ] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[ (#1 - Mod[ #1, b ])/-b &, i, #1 != 0 & ], b ] ] ] ]; Table[ ToNegaBases[ n, 2 ], {n, 0, 31} ]

PROG

(Haskell)

a039724 0 = 0

a039724 n = a039724 n' * 10 + m where

   (n', m) = if r < 0 then (q + 1, r + 2) else (q, r)

             where (q, r) = quotRem n (negate 2)

-- Reinhard Zumkeller, Jul 07 2012

CROSSREFS

Cf. A007088, A005351, A039723, A073785, A007608, A073786, A073787, A073788, A073789, A073790, A039723.

Cf. A212529 (negative numbers in base -2).

Sequence in context: A247391 A110736 A084292 * A008944 A106004 A113556

Adjacent sequences:  A039721 A039722 A039723 * A039725 A039726 A039727

KEYWORD

base,nice,nonn,easy

AUTHOR

Robert Lozyniak (11(AT)onna.com)

EXTENSIONS

More terms from Eric W. Weisstein.

STATUS

approved

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

Content is available under The OEIS End-User License Agreement .

Last modified December 21 12:47 EST 2014. Contains 252321 sequences.