约数和
题目大意
两个函数F(n)为n的约数和,G(n)为F(1)+F(2)+…+F(n-1)+F(n)。求G(G(n))等于多少。
解题思路
首先可以知道,对于 n n n, F ( n ) = ∑ i = 1 n ⌊ n i ⌋ × i F(n)=\sum_{i=1}^n \lfloor \frac ni \rfloor \times i F(n)=∑i=1n⌊in⌋×i
如求 G ( 6 ) G(6) G(6),用暴力解法为:
G ( 6 ) = F ( 1 ) + F ( 2 ) + F ( 3 ) + F ( 4 ) + F ( 5 ) + F ( 6 ) = ( 1 ) + ( 1 + 2 ) + ( 1 + 3 ) + ( 1 + 2 + 4 ) + ( 1 + 5 ) + ( 1 + 2 + 3 + 6 ) = ⌊ 6 1 ⌋ × 1 + ⌊ 6 2 ⌋ × 2 + ⌊ 6 3 ⌋ × 3 + ⌊ 6 4 ⌋ × 4 + ⌊ 6 5 ⌋ × 5 + ⌊ 6 6 ⌋ × 6 = 27 \begin{aligned} G(6) &= F(1)+F(2)+F(3)+F(4)+F(5)+F(6) \\ &=(1)+(1+2)+(1+3)+(1+2+4)+(1+5)+(1+2+3+6) \\ &=\lfloor \frac 61 \rfloor \times 1+\lfloor \frac 62 \rfloor \times 2+\lfloor \frac 63 \rfloor \times 3+\lfloor \frac 64 \rfloor \times 4+\lfloor \frac 65 \rfloor \times 5+\lfloor \frac 66 \rfloor \times 6\\ &=27 \end{aligned} G(6)=F(1)+F(2)+F(3)+F(4)+F(5)+F<