OFFSET
1,2
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
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Reinhard Zumkeller, Rows n = 1..1000 of triangle, flattened
Eric Weisstein's World of Mathematics, Ternary.
Wikipedia, Ternary numeral system
EXAMPLE
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 *)
PROG
(Magma) &cat[Reverse(IntegerToSequence(n, 3)):n in[1..31]]; // Jason Kimberley, Dec 07 2012
(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
(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:])
CROSSREFS
KEYWORD
AUTHOR
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Sep 25 2000
STATUS
approved