A122586 Leading digit of n expressed in base 3.
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, 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, 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
Offset: 1
Examples
a(1) = 1/(3^0) = 1.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
seq( evalf(floor(n/ (3^floor(log[3](n))))), n=1..500);
-
Mathematica
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 *)
Formula
a(n) = floor(n/(3^floor(log(n)/log(3)))).
From Robert Israel, Mar 15 2017: (Start)
a(3n) = a(3n+1) = a(3n+2) = a(n).
G.f.: g(x) satisfies g(x) = x + 2 x^2 + (1+x+x^2) g(x^3). (End)
Extensions
Name changed by Franklin T. Adams-Watters, Sep 29 2011
Comments