%I #57 Jul 12 2022 08:41:28
%S 0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,
%T 1,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,
%U 0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0
%N The maximum exponent k of 7 such that 7^k divides n.
%C 7-adic valuation of n.
%H Harvey P. Dale, <a href="/A214411/b214411.txt">Table of n, a(n) for n = 1..1000</a>
%H Dario T. de Castro, <a href="http://math.colgate.edu/~integers/w61/w61.pdf">P-adic Order of Positive Integers via Binomial Coefficients</a>, INTEGERS, Electronic J. of Combinatorial Number Theory, Vol. 22, Paper A61, 2022.
%F G.f.: Sum_{k>=1} x^(7^k)/(1-x^(7^k)). See A112765. - _Wolfdieter Lang_, Jun 18 2014
%F If n == 0 (mod 7) then a(n) = 1 + a(n/7), otherwise a(n) = 0. - _M. F. Hasler_, Mar 05 2020
%F Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/6. - _Amiram Eldar_, Jan 17 2022
%F a(n) = 7*Sum_{j=1..floor(log(n)/log(7))} frac(binomial(n, 7^j)*7^(j-1)/n). - _Dario T. de Castro_, Jul 12 2022
%e n=147 = 3*7*7 is divisible by 7^2, so a(147)=2.
%p seq(padic:-ordp(n,7), n=1..100); # _Robert Israel_, Mar 05 2020
%t mek[n_]:=Module[{k=Ceiling[Log[7,n]]},While[!Divisible[n,7^k],k--];k]; Array[ mek,140] (* _Harvey P. Dale_, Mar 27 2017 *)
%t IntegerExponent[Range[150],7] (* Suggested by Amiram Eldar *) (* _Harvey P. Dale_, Mar 07 2020 *)
%o (PARI) a(n)=valuation(n,7) \\ _Charles R Greathouse IV_, Jul 17 2012
%o (PARI) A=vector(1000);for(i=1,log(#A+.5)\log(7),forstep(j=7^i,#A,7^i,A[j]++));A \\ _Charles R Greathouse IV_, Jul 17 2012
%Y Cf. A007814 (2-adic), A007949 (3-adic), A112765 (5-adic), A082784.
%K nonn,easy
%O 1,49
%A _Redjan Shabani_, Jul 16 2012