%I #90 Jul 06 2024 05:17:49
%S 1,1,1,1,1,2,1,2,2,2,1,5,1,2,3,3,1,4,1,4,3,2,1,7,3,2,4,4,1,7,1,6,3,2,
%T 5,8,1,2,3,9,1,6,1,4,10,2,1,11,4,6,3,4,1,8,5,9,3,2,1,14,1,2,10,10,5,6,
%U 1,4,3,11,1,17,1,2,9,4,7,6,1,19,10,2,1,13,5,2,3,8,1,21
%N a(1) = 1; for n > 1, a(n) is defined by the property that n^a(n) divides n! but n^(a(n)+1) does not.
%C From _Stefano Spezia_, Nov 08 2018: (Start)
%C It appears that for n > 1 a(n) = 1 iff n = 4 or a prime number (see A175787).
%C It appears that a(n) = 2 iff n is in A074845. (End)
%C Since a prime p is coprime to all positive integers less than p, a(p)=1. - _Robert D. Rosales_, Jun 17 2024
%C If n > 4 is composite then a(n) > 1. Proof: 1) If n is not a square of a prime, then n has a divisor d such that 1 < d < n/d < n, so d, n/d and n appear as different factors in n!, n^2 | n!, and therefore a(n) >= 2. 2) If n = p^2 is a square of a prime, then p, 2*p and p^2 appear as different factors in n! when p > 2, therefore a(n) >= 2 if n != 4. - _Amiram Eldar_, Jul 06 2024
%D Ivan Niven, Herbert S. Zuckerman and Hugh L. Montgomery, An Introduction to the Theory Of Numbers, Fifth Edition, John Wiley and Sons, Inc., NY 1991.
%D Joe Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 251.
%H Alois P. Heinz, <a href="/A011776/b011776.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from T. D. Noe)
%H Nick MacKinnon, <a href="https://doi.org/10.2307/3615678">How many times does n go into nǃ</a>, The Mathematical Gazette, Vol. 70, No. 453 (1986), pp. 203-205.
%H Peter Shui, <a href="http://www.jstor.org/stable/40378569">A footnote on the number of times n goes into n!</a>, The Mathematical Gazette, Vol. 93, No. 528 (2009), pp. 492-495.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Factorial.html">Factorial</a>.
%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>.
%e 12^5 divides 12! but 12^6 does not so a(12) = 5.
%p a := []; for n from 2 to 200 do i := 0: while n! mod n^i = 0 do i := i+1: od: a := [op(a),i-1]; od: a;
%p # second Maple program:
%p f:= proc(n, p) local c, k; c, k:= 0, p;
%p while n>=k do c:= c+iquo(n, k); k:= k*p od; c
%p end:
%p a:= n-> min(seq(iquo(f(n, i[1]), i[2]), i=ifactors(n)[2])): a(1):=1:
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Oct 04 2012
%t Do[m = 1; While[ IntegerQ[ n!/n^m], m++ ]; Print[m - 1], {n, 1, 100} ]
%t HighestPower[n_,p_] := Module[{r,s=0,k=1}, While[r=Floor[n/p^k]; r>0, s=s+r; k++ ];s]; SetAttributes[HighestPower,Listable]; Join[{1}, Table[{p,e}=Transpose[FactorInteger[n]]; Min[Floor[HighestPower[n,p]/e]], {n,2,100}]] (* _T. D. Noe_, Oct 01 2008 *)
%t Join[{1},Table[IntegerExponent[n!,n],{n,2,500}]] (* _Vladimir Joseph Stephan Orlovsky_, Dec 26 2010 *)
%t f[n_, p_] := Module[{c=0, k=p}, While[n >= k , c = c + Quotient[n, k]; k = k*p ]; c]; a[1]=1; a[n_] := Min[ Table[ Quotient[f[n, i[[1]]], i[[2]]], {i, FactorInteger[n] }]]; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 03 2013, after _Alois P. Heinz_'s Maple program *)
%o (Haskell)
%o a011776 1 = 1
%o a011776 n = length $
%o takeWhile ((== 0) . (mod (a000142 n))) $ iterate (* n) n
%o -- _Reinhard Zumkeller_, Sep 01 2012
%o (PARI) a(n)=if(n>1, valuation(n!,n), 1); \\ _Charles R Greathouse IV_, Apr 10 2014
%o (PARI) vp(n,p)=my(s); while(n\=p, s+=n); s
%o a(n)=if(n==1,return(1)); my(f=factor(n)); vecmin(vector(#f~, i, vp(n,f[i,1])\f[i,2])) \\ _Charles R Greathouse IV_, Apr 10 2014
%Y Cf. A011777, A011778, A133481, A000142, A074845.
%Y Diagonal of A090622.
%Y Cf. A175787 (primes together with 4).
%K nonn,easy,look,nice
%O 1,6
%A _Robert G. Wilson v_