A011776 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.
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, 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, 1, 4, 3, 11, 1, 17, 1, 2, 9, 4, 7, 6, 1, 19, 10, 2, 1, 13, 5, 2, 3, 8, 1, 21
Offset: 1
Examples
12^5 divides 12! but 12^6 does not so a(12) = 5.
References
- 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.
- Joe Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 251.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
- Nick MacKinnon, How many times does n go into n!, The Mathematical Gazette, Vol. 70, No. 453 (1986), pp. 203-205.
- Peter Shui, A footnote on the number of times n goes into n!, The Mathematical Gazette, Vol. 93, No. 528 (2009), pp. 492-495.
- Eric Weisstein's World of Mathematics, Factorial.
- Index entries for sequences related to factorial numbers.
Crossrefs
Programs
-
Haskell
a011776 1 = 1 a011776 n = length $ takeWhile ((== 0) . (mod (a000142 n))) $ iterate (* n) n -- Reinhard Zumkeller, Sep 01 2012
-
Maple
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; # second Maple program: f:= proc(n, p) local c, k; c, k:= 0, p; while n>=k do c:= c+iquo(n, k); k:= k*p od; c end: a:= n-> min(seq(iquo(f(n, i[1]), i[2]), i=ifactors(n)[2])): a(1):=1: seq(a(n), n=1..100); # Alois P. Heinz, Oct 04 2012
-
Mathematica
Do[m = 1; While[ IntegerQ[ n!/n^m], m++ ]; Print[m - 1], {n, 1, 100} ] 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 *) Join[{1},Table[IntegerExponent[n!,n],{n,2,500}]] (* Vladimir Joseph Stephan Orlovsky, Dec 26 2010 *) 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 *)
-
PARI
a(n)=if(n>1, valuation(n!,n), 1); \\ Charles R Greathouse IV, Apr 10 2014
-
PARI
vp(n,p)=my(s); while(n\=p, s+=n); s 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
Comments