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 A360505 #20 Feb 19 2023 16:22:09 %S A360505 1,21,1021,111021,12111021,2012111021,212012111021,22212012111021, %T A360505 10022212012111021,10110022212012111021,10210110022212012111021, %U A360505 11010210110022212012111021,11111010210110022212012111021,11211111010210110022212012111021,12011211111010210110022212012111021 %N A360505 Concatenate the ternary strings for n, n-1, n-2, ..., 2, 1. %C A360505 Similar to A360502, but here we count down from n to 1 in base 3 and concatenate the strings to get a(n). %C A360505 This is the ternary analog of A000422. %H A360505 <a href="/index/Mo#MWP">Index entries for sequences related to Most Wanted Primes video</a> %t A360505 a[n_] := FromDigits @ Flatten @ IntegerDigits[Range[n, 1, -1], 3]; Array[a, 15] (* _Amiram Eldar_, Feb 18 2023 *) %o A360505 (PARI) a(n) = strjoin(concat([digits(k, 3) | k <- Vecrev([1..n])])) \\ _Rémy Sigrist_, Feb 18 2023 %o A360505 (Python) %o A360505 from sympy.ntheory import digits %o A360505 def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(n, 0, -1))) %o A360505 print([a(n) for n in range(1, 16)]) # _Michael S. Branicky_, Feb 18 2023 %o A360505 (Python) # faster version for initial segment of sequence %o A360505 from sympy.ntheory import digits %o A360505 from itertools import count, islice %o A360505 def agen(s=""): yield from (int(s:="".join(map(str, digits(n, 3)[1:]))+s) for n in count(1)) %o A360505 print(list(islice(agen(), 15))) # _Michael S. Branicky_, Feb 18 2023 %Y A360505 Cf. A000422, A007809, A360502, A360506. %K A360505 nonn,base %O A360505 1,2 %A A360505 _N. J. A. Sloane_, Feb 17 2023