← Complete problem index

PROJECT EULER · #0839

Beans in Bowls

Statement only · UnsolvedOriginal problem ↗

The sequence Sn is defined by S0=290797 and Sn=Sn12mod50515093 for n>0.

There are N bowls indexed 0,1,,N1. Initially there are Sn beans in bowl n.

At each step, the smallest index n is found such that bowl n has strictly more beans than bowl n+1. Then one bean is moved from bowl n to bowl n+1.

Let B(N) be the number of steps needed to sort the bowls into non-descending order.
For example, B(5)=0, B(6)=14263289 and B(100)=3284417556.

Find B(107).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.