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.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Comments

An irregular table in which the n-th row lists the base-3 digits of n, see A007089. - Jason Kimberley, Dec 07 2012
The base-3 Champernowne constant (A077771): it is normal in base 3. - Jason Kimberley, Dec 07 2012

Examples

			1,
2,
1,0,
1,1,
1,2,
2,0,
2,1,
2,2,
1,0,0,
1,0,1,.... _R. J. Mathar_, Aug 16 2021
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

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
Cf. A081604 (row lengths), A053735 (row sums), A030341 (rows reversed), A077771, A007089.

Programs

  • Haskell
    a003137 n k = a003137_tabf !! (n-1) !! k
    a003137_row n = a003137_tabf !! (n-1)
    a003137_tabf = map reverse $ tail a030341_tabf
    a003137_list = concat a003137_tabf
    -- Reinhard Zumkeller, Feb 21 2013
    
  • Magma
    &cat[Reverse(IntegerToSequence(n,3)):n in[1..31]]; // Jason Kimberley, Dec 07 2012
    
  • Mathematica
    Flatten@ IntegerDigits[ Range@ 40, 3] (* or *)
    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 *)
  • Python
    from itertools import count, islice
    from sympy.ntheory.factor_ import digits
    def A003137_gen(): return (d for m in count(1) for d in digits(m,3)[1:])
    A003137_list = list(islice(A003137_gen(),30)) # Chai Wah Wu, Jan 07 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000