cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A073786 Numbers in base -5.

This page as a plain text file.
%I A073786 #11 Feb 16 2025 08:32:46
%S A073786 0,1,2,3,4,140,141,142,143,144,130,131,132,133,134,120,121,122,123,
%T A073786 124,110,111,112,113,114,100,101,102,103,104,240,241,242,243,244,230,
%U A073786 231,232,233,234,220,221,222,223,224,210,211,212,213,214,200,201,202,203
%N A073786 Numbers in base -5.
%D A073786 D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, 1969, Vol. 2, p. 189.
%H A073786 Chai Wah Wu, <a href="/A073786/b073786.txt">Table of n, a(n) for n = 0..10000</a>
%H A073786 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Negabinary.html">Negabinary</a>
%H A073786 Prepared and presented by Matthew Szudzik of Wolfram Research, <a href="http://library.wolfram.com/conferences/devconf99/challenge/">A Mathematica programming contest</a>
%t A073786 ToNegaBases[i_Integer, b_Integer] := FromDigits[ Rest[ Reverse[ Mod[ NestWhileList[(#1 - Mod[ #1, b])/-b &, i, #1 != 0 &], b]]]]; Table[ ToNegaBases[n, 5], {n, 0, 55}]
%o A073786 (Python)
%o A073786 def A073786(n):
%o A073786     s, q = '', n
%o A073786     while q >= 5 or q < 0:
%o A073786         q, r = divmod(q, -5)
%o A073786         if r < 0:
%o A073786             q += 1
%o A073786             r += 5
%o A073786         s += str(r)
%o A073786     return int(str(q)+s[::-1]) # _Chai Wah Wu_, Apr 09 2016
%Y A073786 Cf. A007091, A039724, A073785, A007608, A073787, A073788, A073789, A073790 & A039723.
%K A073786 base,easy,nonn
%O A073786 0,3
%A A073786 _Robert G. Wilson v_, Aug 11 2002