Block is divisible study notes

For the repeated calculation \ ({\ biggl \ lfloor \ frac {k} {n} \ biggr \ rfloor} \) problems, as a result of monotone, and repeated the same number can be divided into stages, simplified calculation.

Example: Calculation

\[\sum_{i=1}^{n}k\mod i\]

Be turned into

\[nk-\sum_{i=1}^{n}i{\biggl\lfloor\frac{k}{i}\biggr\rfloor}\]

Consider the nature of (the core can be rote

\[{\biggl\lfloor\frac{k}{{\bigl\lfloor\frac{k}{{\bigl\lfloor\frac{k}{i}\bigr\rfloor}}\bigr\rfloor}}\biggr\rfloor}={\biggl\lfloor\frac{k}{i}\biggr\rfloor}\]

Order \ [{{\ biggl \ lfloor \ frac {k} {{\ bigl \ lfloor \ frac {k} {i} \ bigr \ rfloor}} \ biggr \ rfloor}} = g (i) \] every time can be calculated

\[i\sum_{j=g(i-1)+1}^{g(i)}j\]

Use arithmetic sequence summation formula can be.

(To be continued)

Guess you like

Origin www.cnblogs.com/ehznehc/p/11723170.html