Processing math: 100%

Problem #362

Big Josephus

There are n balloons in a cyclic room numbered from 1 to n (Balloon 2 comes after 1, Balloon 3 comes after 2, \dots, Balloon 1 comes after Balloon n). You start at 1. Every turn you skip one balloon and pop the next balloon until there is only one balloon left.

Let F(n) denote the number on the last remaining balloon. Find the sum of F(1) + F(2) + F(3) + \dots + F(182721378) and submit the answer modulo 10^9 + 7.

Contributed by SHUBHAM KUMAR VERMA

Solved by 118 users

Log in to submit answers.

Is something wrong?

Maintaining a collection of high quality questions is our top priority. If, however, you do find an error, report the problem and we'll make sure it is reviewed soon.