The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A007949 Greatest k such that 3^k divides n. Or, 3-adic valuation of n. 128
 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 4, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,9 COMMENTS a(n) mod 2 = 1 - A014578(n). - Reinhard Zumkeller, Oct 04 2008 Obeys the general recurrences for p-adic valuation discussed in A214411. - Redjan Shabani, Jul 17 2012 Lexicographically earliest cubefree sequence, which also (conjecturally) appears in the construction of the lexicographically earliest cubefree {0,1}-sequence A282317, cf. Example section of A286940. - M. F. Hasler, May 21 2017 The sequence is invariant under the "lower trim" operator: remove all zeros, and subtract one from each remaining term. - Franklin T. Adams-Watters, May 25 2017 REFERENCES K. Atanassov, On the 61st, 62nd and the 63rd Smarandache Problems, Notes on Number Theory and Discrete Mathematics, Sophia, Bulgaria, Vol. 4 (1998), No. 4, 175-182. F. Q. Gouvea, p-Adic Numbers, Springer-Verlag, 1993; see p. 23. M. Vassilev-Missana and K. Atanassov, Some Representations related to n!, Notes on Number Theory and Discrete Mathematics, Vol. 4 (1998), No. 4, 148-153. LINKS T. D. Noe, Table of n, a(n) for n = 1..1000 K. Atanassov, On Some of Smarandache's Problems, American Research Press, 1999, 16-21. F. Smarandache, Only Problems, Not Solutions!. S. Northshield, An Analogue of Stern's Sequence for Z[sqrt(2)], Journal of Integer Sequences, 18 (2015), #15.11.6. FORMULA a(n) = 0 if n != 0 (mod 3), otherwise a(n) = 1 + a(n/3). - Reinhard Zumkeller, Aug 12 2001, edited by M. F. Hasler, Aug 11 2015 From Ralf Stephan, Apr 12 2002: (Start) a(n) = A051064(n) - 1. G.f.: Sum_{k>=1} x^3^k/(1 - x^3^k). (End) Fixed point of the morphism: 0 -> 001; 1 -> 002; 2 -> 003; 3 -> 004; 4 -> 005; etc.; starting from a(1) = 0. - Philippe Deléham, Mar 29 2004 Totally additive with a(p) = 1 if p = 3, 0 otherwise. v_{m}(n) = Sum_{r>=1} (r/m^(r+1)) Sum_{j=1..m-1} Sum_{k=0..m^(r+1)-1} exp((2*k*Pi*i*(n+(m-j)*m^r)) / m^(r+1)). This formula is for the general case; for this specific one, set m=3. - A. Neves, Oct 04 2010 a(3n) = A051064(n), a(2n) = a(n), a(2n-1) = A253786(n). - Cyril Damamme, Aug 04 2015 a(3n) = a(n) + 1, a(pn) = a(n) for any other prime p != 3. - M. F. Hasler, Aug 11 2015 3^a(n) = A038500(n). - Antti Karttunen, Oct 09 2017 Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Jul 11 2020 MAPLE A007949 := proc(n) option remember; if n mod 3 > 0 then 0 else procname(n/3)+1; fi; end; # alternative by R. J. Mathar, Mar 29 2017 A007949 := proc(n)     padic[ordp](n, 3) ; end proc: MATHEMATICA p=3; Array[ If[ Mod[ #, p ]==0, Select[ FactorInteger[ # ], Function[ q, q[ [ 1 ] ]==p ], 1 ][ [ 1, 2 ] ], 0 ]&, 81 ] Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 0, 1}, 1 -> {0, 0, 2}, 2 -> {0, 0, 3}, 3 -> {0, 0, 4}}) ]}], {0}, 5] (* Robert G. Wilson v, Mar 03 2005 *) IntegerExponent[Range, 3] (* Zak Seidov, Apr 15 2010 *) Table[If[Mod[n, 3] > 0, 0, 1 + b[n/3]], {n, 200}] (* Zak Seidov, Apr 15 2010 *) PROG (PARI) a(n)=valuation(n, 3) (Haskell) a007949 n = if m > 0 then 0 else 1 + a007949 n'             where (n', m) = divMod n 3 -- Reinhard Zumkeller, Jun 23 2013, May 14 2011 (MATLAB) % Input: %  n: an integer % Output: %  m: max power of 3 such that 3^m divides n %  M: 1-by-K matrix where M(i) is the max power of 3 such that 3^M(i) divides n function [m, M] = Omega3(n)   M = NaN*zeros(1, n);   M(1)=0; M(2)=0; M(3)=0;     for k=4:n       if M(k-3)~=0         M(k)=M(k-k/3)+1;       else         M(k)=0;       end     end     m=M(end); end % Redjan Shabani, Jul 17 2012 (Sage) [valuation(n, 3) for n in (1..106)]  # Peter Luschny, Nov 16 2012 (MAGMA) [Valuation(n, 3): n in [1..110]]; // Bruno Berselli, Aug 05 2013 (Scheme) (define (A007949 n) (let loop ((n n) (k 0)) (cond ((not (zero? (modulo n 3))) k) (else (loop (/ n 3) (+ 1 k)))))) ;; Antti Karttunen, Oct 06 2017 CROSSREFS Partial sums give A054861. Cf. A038500, A080278, A001511, A122841, A007814, A112765, A253786. One less than A051064. Sequence in context: A212663 A015692 A016232 * A191265 A320003 A291749 Adjacent sequences:  A007946 A007947 A007948 * A007950 A007951 A007952 KEYWORD nonn,easy AUTHOR R. Muller STATUS approved

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

Last modified September 19 01:52 EDT 2020. Contains 337175 sequences. (Running on oeis4.)