## Whenever Peter feels bored, he places some bowls, containing one bean each, in a circle. After this, he takes all the beans out of a certain bowl and drops them one by one in the bowls going clockwise. He repeats this, starting from the bowl he dropped the last bean in, until the initial situation appears again. For example with 5 bowls he acts as follows:

So with $5$ bowls it takes Peter $15$ moves to return to the initial situation.

Let $M(x)$ represent the number of moves required to return to the initial situation, starting with $x$ bowls. Thus, $M(5) = 15$. It can also be verified that $M(100) = 10920$.

Find $\displaystyle \sum_{k=0}^{10^{18}} M(2^k + 1)$. Give your answer modulo $7^9$.

### This problem involves the exploration of number patterns and sequences. Due to the scale of the problem ($k$ goes up to $10^{18}$), we’ll need to simplify the problem.

Firstly, the numbers of moves Peter made can be interpreted as a list that starts from $2^0 + 1 = 2$, up to $2^{10^{18}} + 1$. So the problem can be translated into finding a pattern for M(2^k+1) in mathematics.

The function M(n) appears to be related to the least common multiple (LCM) of some subset of the numbers $1$ to $n-1$. One can derive an efficient algorithm to compute the LCM since the numbers are rather large.

To get a clear understanding, let’s find a pattern by computing more M(n) values manually or through computer programs for small n. After generating enough values, analyze the data and try to identify any patterns.

Nearly impossible to solve it manually. However, with the proper use of computer algorithm combined with number theory, there is a solution.

Solving such problem simply boils down to finding a pattern for M(2^k+1) which is easier said than done. The approach is:

– Generate enough values so that you can analyze the results and identify a pattern.

– Once a pattern is found, create an algorithm that is efficient enough to compute the results for such large numbers, keeping in mind integer overflow errors, as the numbers can be quite large.

– Finally, the result should be the sum of M(2^k+1) modulo $7^9$.

Since the question involves advanced mathematics, a thorough understanding of number theory, programming and modular arithmetic is required.

##### More Answers:

Cross FlipsSpecial Partitions

Spilling the Beans