maximum power of a prime number d that can divide n!

Revision en2, by dra2421, 2020-05-31 21:12:14

why long long k =d ,cc=0 ; while(n >=k) cc += (n/k) ,k *=d; is wrong

while this is correct long long k =d ,cc=0 ; while(n) cc +=n/k , n /=k ;

Tags #number theory, #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English dra2421 2020-05-31 21:12:14 6
en1 English dra2421 2020-05-30 19:22:53 204 Initial revision (published)