login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
3^a(n) divides 4^n-1. - Benoit Cloitre, Oct 25 2004
Generalized Ruler Function for k=3. - Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca)
a(A007417(n)) is odd and a(A145204(n)) is even. - Reinhard Zumkeller, May 23 2013
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
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
A. M. Hinz, S. Klavžar, U. Milutinović, and C. Petr, The Tower of Hanoi - Myths and Maths, Birkhäuser 2013. See page 243. Book's website
Simon Plouffe, On the values of the functions zeta and gamma, arXiv preprint arXiv:1310.7195 [math.NT], 2013.
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
a(n) = A007949(n) + 1 = A004128(n) - A004128(n-1).
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
a(n) = (1/2)*(3 - A053735(n) + A053735(n-1)) for n >= 1. - Tom Edgar, Aug 06 2014
a(n) = A007949(3n). - Cyril Damamme, Aug 04 2015
a(2n) = a(n), a(2n-1) = A254046(n). - Cyril Damamme, Aug 04 2015
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
seq(1+padic:-ordp(n, 3), n=1..100); # Robert Israel, Aug 07 2014
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 *)
Table[ IntegerExponent[3n, 3], {n, 1, 105}] (* Jean-François Alcover, Oct 10 2011 *)
PROG
(PARI) a(n)=if(n<1, 0, 1+valuation(n, 3))
(Haskell)
a051064 = (+ 1) . length .
takeWhile (== 3) . dropWhile (== 2) . a027746_row
-- Reinhard Zumkeller, May 23 2013
(Python)
def A051064(n):
c = 1
a, b = divmod(n, 3)
while b == 0:
a, b = divmod(a, 3)
c += 1
return c # Chai Wah Wu, Apr 18 2022
CROSSREFS
Partial sums give A004128.
Cf. A254046.
Sequence in context: A101022 A241153 A213852 * A280509 A153096 A343407
KEYWORD
nonn,easy,nice,mult
AUTHOR
EXTENSIONS
More terms from James A. Sellers, Dec 11 1999
More terms from Vladeta Jovovic, Aug 24 2002
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 19 04:26 EDT 2024. Contains 370952 sequences. (Running on oeis4.)