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 A030341 #34 Feb 16 2025 08:32:35 %S A030341 0,1,2,0,1,1,1,2,1,0,2,1,2,2,2,0,0,1,1,0,1,2,0,1,0,1,1,1,1,1,2,1,1,0, %T A030341 2,1,1,2,1,2,2,1,0,0,2,1,0,2,2,0,2,0,1,2,1,1,2,2,1,2,0,2,2,1,2,2,2,2, %U A030341 2,0,0,0,1,1,0,0,1,2,0,0,1,0,1,0,1,1,1,0,1,2,1,0,1 %N A030341 Triangle T(n,k): write n in base 3, reverse order of digits. %H A030341 Reinhard Zumkeller, <a href="/A030341/b030341.txt">Rows n = 0..1000 of triangle, flattened</a> %H A030341 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary.</a> %H A030341 Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a> %e A030341 Triangle begins : %e A030341 0 %e A030341 1 %e A030341 2 %e A030341 0, 1 %e A030341 1, 1 %e A030341 2, 1 %e A030341 0, 2 %e A030341 1, 2 %e A030341 2, 2 %e A030341 0, 0, 1 %e A030341 1, 0, 1 %e A030341 2, 0, 1 %e A030341 0, 1, 1 %e A030341 1, 1, 1 %e A030341 2, 1, 1 ... %p A030341 A030341_row := n -> op(convert(n, base, 3)): %p A030341 seq(A030341_row(n), n=0..32); # _Peter Luschny_, Nov 28 2017 %t A030341 Flatten[Table[Reverse[IntegerDigits[n,3]],{n,0,40}]] (* _Harvey P. Dale_, Oct 20 2014 *) %o A030341 (Haskell) %o A030341 a030341 n k = a030341_tabf !! n !! k %o A030341 a030341_row n = a030341_tabf !! n %o A030341 a030341_tabf = iterate succ [0] where %o A030341 succ [] = [1] %o A030341 succ (2:ts) = 0 : succ ts %o A030341 succ (t:ts) = (t + 1) : ts %o A030341 -- _Reinhard Zumkeller_, Feb 21 2013 %o A030341 (PARI) A030341(n, k=-1)=/*k<0&&error("Flattened sequence not yet implemented.")*/n\3^k%3 \\ Assuming that columns are numbered starting with k=0 as in A030308, A030567 and others. - _M. F. Hasler_, Jul 21 2013 %Y A030341 Cf. A081604 (row lengths), A053735 (row sums), A007089, A003137. %Y A030341 Cf. A030308, A030386, A031235, A030567, A031007, A031045, A031087, A031298 for the base-2 to base-10 analogs. %K A030341 nonn,base,tabf,less %O A030341 0,3 %A A030341 _Clark Kimberling_ %E A030341 Initial 0 and better name by _Philippe Deléham_, Oct 20 2011