OFFSET
1,4
REFERENCES
R. L. Graham, D. E. Knuth and O. Patashnik, Factorial Factors, Section 4.4 in Concrete Mathematics, 2nd ed. Reading, MA: Addison-Wesley, pp. 111-115, 1994.
LINKS
Eric Weisstein's World of Mathematics, Greatest Prime Factor
Eric Weisstein's World of Mathematics, Factorial
FORMULA
MATHEMATICA
With[{p=First[Last[FactorInteger[n, FactorComplete->True]]]}, 1+Sum[Floor[(n-1)/p^k], {k, Floor[Log[n-1]/Log[p]]}]]
PROG
(PARI) A102048(n, p=A006530(n))=1+if(n>1, sum(k=1, logint(n-=1, p), n\p^k)) \\ M. F. Hasler, Nov 27 2018
(Python)
from sympy import primefactors, integer_log
def A102048(n):
if n == 1: return 1
p = max(primefactors(n))
return 1+sum((n-1)//p**k for k in range(1, integer_log(n-1, p)[0]+1)) # Chai Wah Wu, Oct 17 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Jonathan Sondow, Dec 26 2004
STATUS
approved