Real Recursive Euclidean-like algorithm

Правка en5, от OtterZ, 2025-07-22 05:08:30

In the Blog post from RP-1 we learnt how to calculate $$$\sum_{i = 0}^n {[\frac{A\cdot i + B}{C}]}$$$ in $$$\operatorname{O}(\sqrt n)$$$, then he mentioned that there is a recursive euclidean-like algorithm to calculate it in $$$\operatorname{O}(\log n)$$$. Today, as I've just been introduced to the solution by Leo_W, I would like to write it down here as an extend.

1.Theory

We define that $\operatorname{f}(n,a,b,c) = \lfloor \frac{A\cdot i + B}{C}\rfloor

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en9 Английский OtterZ 2025-09-10 10:35:17 3208 (published)
en8 Английский OtterZ 2025-07-22 06:54:16 12
en7 Английский OtterZ 2025-07-22 06:52:34 326
en6 Английский OtterZ 2025-07-22 05:08:39 1 Tiny change: '{C}\rfloor' -> '{C}\rfloor$'
en5 Английский OtterZ 2025-07-22 05:08:30 98
en4 Английский OtterZ 2025-07-21 17:04:58 250 Tiny change: ' + B}{C}]} in $\oper' -> ' + B}{C}]}$ in $\oper'
en3 Английский OtterZ 2025-07-21 16:50:53 407
en2 Английский OtterZ 2025-04-27 09:47:44 0 (saved to drafts)
en1 Английский OtterZ 2025-04-27 09:45:53 381 Initial revision (published)