0%

Problem 340


Problem 340


Crazy Function

For fixed integers a, b, c, define the crazy function F(n) as follows:
F(n) = n - c for all n > b
F(n) = F(a + F(a + F(a + F(a + n)))) for all n ≤ b

Also, define S(a, b, c) = $\sum_{n=0}^{b}F(n)$.

For example, if a = 50, b = 2000 and c = 40, then F(0) = 3240 and F(2000) = 2040.
Also, S(50, 2000, 40) = 5204240.

Find the last 9 digits of S(217, 721, 127).


疯狂函数

对于给定的整数a、b、c,定义疯狂函数F(n)如下:
对于所有n > b,F(n) = n - c
对于所有n ≤ b,F(n) = F(a + F(a + F(a + F(a + n))))

此外,定义S(a, b, c) = $\sum_{n=0}^{b}F(n)$。

举例来说,如果a = 50、b = 2000以及c = 40,那么F(0) = 3240而F(2000) = 2040。
此外,S(50, 2000, 40) = 5204240。

求S(217, 721, 127)的最后9位数字。