Is there any way to calculate the powers of 2 and 5 in a product of consecutive n numbers, if given l and r.
i.e Suppose x=l×(l+1)×(l+2)×......×(r−1)×r, Then if x=2p1.3p2.5p3.7p4...., So I am interested a direct way of calculating p1 and p3 with just l and r
I am just curious about it. I just want 2 & 5, but if there is a general solution for any prime number, It would be great if you mention that.
Answer
Let, us define the product of first n integers by n!.
Now,highest power of prime p contained in n! is given by-
phighest power=⌊np1⌋+⌊np2⌋+⌊np3⌋+...+⌊npn⌋ where pn≤n and ⌊x⌋ is the greatest integer function.
For more information see this-De Polignac's Formula.
No comments:
Post a Comment