cp's OEIS Frontend

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.

A051064 3^a(n) exactly divides 3n. Or, 3-adic valuation of 3n.

This page as a plain text file.
%I A051064 #153 Jul 02 2025 16:01:58
%S A051064 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,
%T A051064 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,
%U A051064 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
%N A051064 3^a(n) exactly divides 3n. Or, 3-adic valuation of 3n.
%C A051064 a(n) is the Hamming distance between n and n-1 in ternary representation. - _Philippe Deléham_, Mar 29 2004
%C A051064 3^a(n) divides 4^n-1. - _Benoit Cloitre_, Oct 25 2004
%C A051064 Generalized Ruler Function for k=3. - _Frank Ruskey_ and Chris Deugau (deugaucj(AT)uvic.ca)
%C A051064 a(A007417(n)) is odd and a(A145204(n)) is even. - _Reinhard Zumkeller_, May 23 2013
%C A051064 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
%C A051064 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
%C A051064 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
%C A051064 The number of powers of 3 that divide n. - _Amiram Eldar_, Mar 29 2025
%D A051064 Letter from Gary W. Adamson to N. J. A. Sloane concerning Prouhet-Thue-Morse sequence, Nov. 11, 1999.
%H A051064 Amiram Eldar, <a href="/A051064/b051064.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from T. D. Noe)
%H A051064 A. M. Hinz, S. Klavžar, U. Milutinović, and C. Petr, <a href="http://dx.doi.org/10.1007/978-3-0348-0237-6">The Tower of Hanoi - Myths and Maths</a>, Birkhäuser 2013. See page 243. <a href="http://tohbook.info">Book's website</a>
%H A051064 Tamas Lengyel, <a href="https://www.fq.math.ca/Scanned/41-1/lengyel.pdf">Divisiblity Properties by Multisection</a>, Fib. Quart. 41 (1) (2003) 72.
%H A051064 Simon Plouffe, <a href="https://arxiv.org/abs/1310.7195">On the values of the functions zeta and gamma</a>, arXiv preprint arXiv:1310.7195 [math.NT], 2013.
%H A051064 Joseph Rosenbaum, <a href="https://doi.org/10.2307/2302451">Elementary Problem E319</a>, 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.)
%H A051064 <a href="/index/Fi#FIXEDPOINTS">Index entries for sequences that are fixed points of mappings</a>.
%F A051064 a(n) = A007949(n) + 1 = A004128(n) - A004128(n-1).
%F A051064 Multiplicative with a(p^e) = e+1 if p = 3; 1 if p <> 3. - _Vladeta Jovovic_, Aug 24 2002
%F A051064 G.f.: Sum_{k>=0} x^3^k/(1-x^3^k). - _Ralf Stephan_, Apr 12 2002
%F A051064 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
%F A051064 a(n) = (-1)*Sum_{d divides n} mu(3d)*tau(n/d). - _Benoit Cloitre_, Jun 21 2007
%F A051064 Dirichlet g.f.: zeta(s)/(1-1/3^s). - _R. J. Mathar_, Jun 13 2011
%F A051064 a(n) = (1/2)*(3 - A053735(n) + A053735(n-1)) for n >= 1. - _Tom Edgar_, Aug 06 2014
%F A051064 a(n) = A007949(3n). - _Cyril Damamme_, Aug 04 2015
%F A051064 a(2n) = a(n), a(2n-1) = A254046(n). - _Cyril Damamme_, Aug 04 2015
%F A051064 G.f. A(x) satisfies: A(x) = A(x^3) + x/(1 - x). - _Ilya Gutkovskiy_, May 03 2019
%F A051064 Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/2. - _Amiram Eldar_, Sep 11 2020 [corrected by _Vaclav Kotesovec_, Jun 25 2024, see also A004128]
%F A051064 a(n) = tau(n)/(tau(3*n) - tau(n)), where tau(n) = A000005(n). - _Peter Bala_, Jan 06 2021
%F A051064 G.f.: Sum_{i>=1, j>=0} x^(i*3^j). - _Seiichi Manyama_, Mar 23 2025
%F A051064 Conjecture: a(n) = A007949(A000045(4*n)), all other 3-adic quadrisections A007949(A000045(.))=0. [Lengyel?]. - _R. J. Mathar_, Jun 28 2025
%e A051064 3^2 | 3*6 = 18, so a(6) = 2.
%p A051064 seq(1+padic:-ordp(n,3), n=1..100); # _Robert Israel_, Aug 07 2014
%t A051064 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 *)
%t A051064 Table[ IntegerExponent[3n, 3], {n, 1, 105}] (* _Jean-François Alcover_, Oct 10 2011 *)
%o A051064 (PARI) a(n)=if(n<1,0,1+valuation(n,3))
%o A051064 (Haskell)
%o A051064 a051064 = (+ 1) . length .
%o A051064                   takeWhile (== 3) . dropWhile (== 2) . a027746_row
%o A051064 -- _Reinhard Zumkeller_, May 23 2013
%o A051064 (Python)
%o A051064 def A051064(n):
%o A051064     c = 1
%o A051064     a, b = divmod(n,3)
%o A051064     while b == 0:
%o A051064         a, b = divmod(a,3)
%o A051064         c += 1
%o A051064     return c # _Chai Wah Wu_, Apr 18 2022
%Y A051064 Cf. A007949.
%Y A051064 Partial sums give A004128.
%Y A051064 Cf. A000005, A027746.
%Y A051064 Cf. A254046.
%Y A051064 Cf. A001511, A055457, A115362, A373216, A373217.
%K A051064 nonn,easy,nice,mult
%O A051064 1,3
%A A051064 _N. J. A. Sloane_, _Gary W. Adamson_
%E A051064 More terms from _James Sellers_, Dec 11 1999
%E A051064 More terms from _Vladeta Jovovic_, Aug 24 2002