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.
%I A007089 M1960 #66 Jul 02 2025 16:01:55 %S A007089 0,1,2,10,11,12,20,21,22,100,101,102,110,111,112,120,121,122,200,201, %T A007089 202,210,211,212,220,221,222,1000,1001,1002,1010,1011,1012,1020,1021, %U A007089 1022,1100,1101,1102,1110,1111,1112,1120,1121,1122,1200,1201,1202,1210,1211 %N A007089 Numbers in base 3. %C A007089 Nonnegative integers with no decimal digit > 2. Thus nonnegative integers in base 10 whose quadrupling by normal addition or multiplication requires no carry operation. - _Rick L. Shepherd_, Jun 25 2009 %D A007089 Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, ยง2.3 Positional Notation, p. 47. %D A007089 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A007089 T. D. Noe, <a href="/A007089/b007089.txt">Table of n, a(n) for n = 0..10000</a> %H A007089 The Unicode Consortium, <a href="http://www.unicode.org/charts/PDF/Unicode-4.0/U40-1D300.pdf">Tai Xuan Jing Symbols</a>. %H A007089 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary</a>. %H A007089 Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>. %H A007089 Robert G. Wilson v, <a href="/A007088/a007088.pdf">Letter to N. J. A. Sloane, Sep. 1992</a> %H A007089 <a href="/index/Mo#MWP">Index entries for sequences related to Most Wanted Primes video</a>. %H A007089 <a href="/index/Ar#10-automatic">Index entries for 10-automatic sequences</a>. %F A007089 a(0)=0, a(n) = 10*a(n/3) if n==0 (mod 3), a(n) = a(n-1) + 1 otherwise. - _Benoit Cloitre_, Dec 22 2002 %F A007089 a(n) = 10*a(floor(n/3)) + (n mod 3) if n > 0, a(0) = 0. - _M. F. Hasler_, Feb 15 2023 %p A007089 A007089 := proc(n) option remember; %p A007089 if n <= 0 then 0 %p A007089 else %p A007089 if (n mod 3) = 0 then 10*procname(n/3) else procname(n-1) + 1 fi %p A007089 fi end: %p A007089 [seq(A007089(n), n=0..729)]; # - _N. J. A. Sloane_, Mar 09 2019 %t A007089 Table[ FromDigits[ IntegerDigits[n, 3]], {n, 0, 50}] %o A007089 (PARI) a(n)=if(n<1,0,if(n%3,a(n-1)+1,10*a(n/3))) %o A007089 (PARI) a(n)=fromdigits(digits(n,3)) \\ _Charles R Greathouse IV_, Jan 08 2017 %o A007089 (Haskell) %o A007089 a007089 0 = 0 %o A007089 a007089 n = 10 * a007089 n' + m where (n', m) = divMod n 3 %o A007089 -- _Reinhard Zumkeller_, Feb 19 2012 %o A007089 (Python) %o A007089 def A007089(n): %o A007089 n,s = divmod(n,3); t = 1 %o A007089 while n: n,r = divmod(n,3); t *= 10; s += r*t %o A007089 return s # _M. F. Hasler_, Feb 15 2023 %Y A007089 Cf. A000042, A007088, A007090, A007091, A007092, A007093, A007094, A007095, A077267, A062756, A081603, A081604, A054635, A003137. %Y A007089 Primes when read as if in base 10: A036954. %K A007089 base,nonn,easy %O A007089 0,3 %A A007089 _N. J. A. Sloane_, _Robert G. Wilson v_ %E A007089 More terms from _James Sellers_, May 01 2000