Exponent of p in the prime factorization of n! is given by ⌊logpn⌋∑i=1⌊npi⌋.
Can this sum be simplified further to some direct expression so that the number of calculations are reduced?
Answer
yes:
N−σp(N)p−1
where σp(N) is the sum of digits in the p-ary expression of N
No comments:
Post a Comment