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.

A003137 Write n in base 3 and juxtapose.

This page as a plain text file.
%I A003137 M0040 #66 Feb 16 2025 08:32:27
%S A003137 1,2,1,0,1,1,1,2,2,0,2,1,2,2,1,0,0,1,0,1,1,0,2,1,1,0,1,1,1,1,1,2,1,2,
%T A003137 0,1,2,1,1,2,2,2,0,0,2,0,1,2,0,2,2,1,0,2,1,1,2,1,2,2,2,0,2,2,1,2,2,2,
%U A003137 1,0,0,0,1,0,0,1,1,0,0,2,1,0,1,0,1,0,1,1,1,0,1,2,1,0,2,0,1,0,2,1,1,0,2,2,1
%N A003137 Write n in base 3 and juxtapose.
%C A003137 An irregular table in which the n-th row lists the base-3 digits of n, see A007089. - _Jason Kimberley_, Dec 07 2012
%C A003137 The base-3 Champernowne constant (A077771): it is normal in base 3. - _Jason Kimberley_, Dec 07 2012
%D A003137 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A003137 Reinhard Zumkeller, <a href="/A003137/b003137.txt">Rows n = 1..1000 of triangle, flattened</a>
%H A003137 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary.</a>
%H A003137 Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>
%e A003137 1,
%e A003137 2,
%e A003137 1,0,
%e A003137 1,1,
%e A003137 1,2,
%e A003137 2,0,
%e A003137 2,1,
%e A003137 2,2,
%e A003137 1,0,0,
%e A003137 1,0,1,.... _R. J. Mathar_, Aug 16 2021
%t A003137 Flatten@ IntegerDigits[ Range@ 40, 3] (* or *)
%t A003137 almostNatural[n_, b_] := Block[{m = 0, d = n, i = 1, l, p}, While[m <= d, l = m; m = (b - 1) i*b^(i - 1) + l; i++]; i--; p = Mod[d - l, i]; q = Floor[(d - l)/i] + b^(i - 1); If[p != 0, IntegerDigits[q, b][[p]], Mod[q - 1, b]]]; Array[ a[#, 3] &, 105] (* _Robert G. Wilson v_, Jul 01 2014 *)
%o A003137 (Magma) &cat[Reverse(IntegerToSequence(n,3)):n in[1..31]]; // _Jason Kimberley_, Dec 07 2012
%o A003137 (Haskell)
%o A003137 a003137 n k = a003137_tabf !! (n-1) !! k
%o A003137 a003137_row n = a003137_tabf !! (n-1)
%o A003137 a003137_tabf = map reverse $ tail a030341_tabf
%o A003137 a003137_list = concat a003137_tabf
%o A003137 -- _Reinhard Zumkeller_, Feb 21 2013
%o A003137 (Python)
%o A003137 from itertools import count, islice
%o A003137 from sympy.ntheory.factor_ import digits
%o A003137 def A003137_gen(): return (d for m in count(1) for d in digits(m,3)[1:])
%o A003137 A003137_list = list(islice(A003137_gen(),30)) # _Chai Wah Wu_, Jan 07 2022
%Y A003137 Tables in which the n-th row lists the base b digits of n: A030190 and A030302 (b=2), this sequence and A054635 (b=3), A030373 (b=4), A031219 (b=5), A030548 (b=6), A030998 (b=7), A031035 and A054634 (b=8), A031076 (b=9), A007376 and A033307 (b=10). - _Jason Kimberley_, Dec 06 2012
%Y A003137 Cf. A081604 (row lengths), A053735 (row sums), A030341 (rows reversed), A077771, A007089.
%K A003137 nonn,base,cons,easy,tabf
%O A003137 1,2
%A A003137 _N. J. A. Sloane_
%E A003137 More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000