|
|
A051064
|
|
3^a(n) exactly divides 3n. Or, 3-adic valuation of 3n.
|
|
36
|
|
|
1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 4, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 4, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 5, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 2, 1, 1, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
a(n) is the Hamming distance between n and n-1 in ternary representation. - Philippe Deléham, Mar 29 2004
Generalized Ruler Function for k=3. - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
First n terms comprise least cubefree word of length n using positive integers, where "cubefree" means that the word contains no three consecutive identical subwords; e.g., 1 contains no cube; 11 contains no cube; 111 does but 112 does not; ... 1,1,2,1,1,2,1,1,1 does, and 1,1,2,1,1,2,1,1,2 does, but 1,1,2,1,1,2,1,1,3 does not, etc. - Clark Kimberling, Sep 10 2013
The sequence is invariant under the "lower trim" operator: remove all ones, and subtract one from each remaining term. - Franklin T. Adams-Watters, May 25 2017
a(n) is the dimension in which the coordinates of the vertices n-1 and n differ in the ternary reflected Gray code. - Arie Bos, Jul 12 2023
|
|
REFERENCES
|
Letter from Gary W. Adamson to N. J. A. Sloane concerning Prouhet-Thue-Morse sequence, Nov. 11, 1999.
|
|
LINKS
|
Joseph Rosenbaum, Elementary Problem E319, American Mathematical Monthly, volume 45, number 10, December 1938, pages 694-696. (The A indices in P at equations 1' and 2' for p=3.)
|
|
FORMULA
|
Multiplicative with a(p^e) = e+1 if p = 3; 1 if p <> 3. - Vladeta Jovovic, Aug 24 2002
G.f.: Sum_{k>=0} x^3^k/(1-x^3^k). - Ralf Stephan, Apr 12 2002
Fixed point of the morphism: 1 -> 112; 2 -> 113; 3 -> 114; 4 -> 115; ...; starting from a(1) = 1. a(3n+1) = a(3n+2) = 1; a(3n) = 1 + a(n). - Philippe Deléham, Mar 29 2004
a(n) = (-1)*Sum_{d divides n} mu(3d)*tau(n/d). - Benoit Cloitre, Jun 21 2007
Dirichlet g.f.: zeta(s)/(1-1/3^s). - R. J. Mathar, Jun 13 2011
G.f. A(x) satisfies: A(x) = A(x^3) + x/(1 - x). - Ilya Gutkovskiy, May 03 2019
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/4. - Amiram Eldar, Sep 11 2020
a(n) = tau(n)/(tau(3*n) - tau(n)), where tau(n) = A000005(n). - Peter Bala, Jan 06 2021
|
|
EXAMPLE
|
3^2 | 3*6 = 18, so a(6) = 2.
|
|
MAPLE
|
|
|
MATHEMATICA
|
Nest[ Function[ l, {Flatten[(l /. {1 -> {1, 1, 2}, 2 -> {1, 1, 3}, 3 -> {1, 1, 4}, 4 -> {1, 1, 5}})]}], {1}, 5] (* Robert G. Wilson v, Mar 03 2005 *)
|
|
PROG
|
(PARI) a(n)=if(n<1, 0, 1+valuation(n, 3))
(Haskell)
a051064 = (+ 1) . length .
takeWhile (== 3) . dropWhile (== 2) . a027746_row
(Python)
c = 1
a, b = divmod(n, 3)
while b == 0:
a, b = divmod(a, 3)
c += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,nice,mult
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|