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 A122586 #23 Mar 12 2023 10:37:14 %S A122586 1,2,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1, %T A122586 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, %U A122586 2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 %N A122586 Leading digit of n expressed in base 3. %C A122586 Values 1 and 2 appear alternately and each time in runs whose lengths are the powers of 3. Each power of 3 is used twice: once for a run of 1's and then for a run of 2's. %H A122586 Robert Israel, <a href="/A122586/b122586.txt">Table of n, a(n) for n = 1..10000</a> %F A122586 a(n) = floor(n/(3^floor(log(n)/log(3)))). %F A122586 From _Robert Israel_, Mar 15 2017: (Start) %F A122586 a(3n) = a(3n+1) = a(3n+2) = a(n). %F A122586 G.f.: g(x) satisfies g(x) = x + 2 x^2 + (1+x+x^2) g(x^3). (End) %e A122586 a(1) = 1/(3^0) = 1. %p A122586 seq( evalf(floor(n/ (3^floor(log[3](n))))), n=1..500); %t A122586 Table[IntegerDigits[n,3][[1]],{n,110}] (* or *) Table[{PadRight[{},3^k,1],PadRight[ {},3^k,2]},{k,0,4}]//Flatten (* _Harvey P. Dale_, Mar 12 2023 *) %K A122586 easy,nonn,base %O A122586 1,2 %A A122586 Peter C. Heinig (algorithms(AT)gmx.de), Oct 20 2006 %E A122586 Name changed by _Franklin T. Adams-Watters_, Sep 29 2011