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!)
A073787 Numbers in base -6. 11

%I #10 Apr 09 2016 17:06:35

%S 0,1,2,3,4,5,150,151,152,153,154,155,140,141,142,143,144,145,130,131,

%T 132,133,134,135,120,121,122,123,124,125,110,111,112,113,114,115,100,

%U 101,102,103,104,105,250,251,252,253,254,255,240,241,242,243,244,245

%N Numbers in base -6.

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

%H Chai Wah Wu, <a href="/A073787/b073787.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Negabinary.html">Negabinary</a>

%H Prepared and presented by Matthew Szudzik of Wolfram Research, <a href="http://library.wolfram.com/conferences/devconf99/challenge/">A Mathematica programming contest</a>

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

%o (Python)

%o def A073787(n):

%o s, q = '', n

%o while q >= 6 or q < 0:

%o q, r = divmod(q, -6)

%o if r < 0:

%o q += 1

%o r += 6

%o s += str(r)

%o return int(str(q)+s[::-1]) # _Chai Wah Wu_, Apr 09 2016

%Y Cf. A007092, A039724, A073785, A007608, A073786, A073788, A073789, A073790 & A039723.

%K base,easy,nonn

%O 0,3

%A _Robert G. Wilson v_, Aug 11 2002

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 April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)