Skip to content

Commit 671d873

Browse files
authored
Cite Legendre's Formula (cp-algorithms#1019)
1 parent 90f18bf commit 671d873

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/algebra/factorial-divisors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The final answer is
2424

2525
$$\Bigl\lfloor\dfrac{n}{k}\Bigr\rfloor + \Bigl\lfloor\dfrac{n}{k^2}\Bigr\rfloor + \ldots + \Bigl\lfloor\dfrac{n}{k^i}\Bigr\rfloor + \ldots$$
2626

27+
This result is also known as [Legendre's formula](https://en.wikipedia.org/wiki/Legendre%27s_formula).
2728
The sum is of course finite, since only approximately the first $\log_k n$ elements are not zeros. Thus, the runtime of this algorithm is $O(\log_k n)$.
2829

2930
### Implementation

0 commit comments

Comments
 (0)