← Complete problem index

PROJECT EULER · #0847

Jack's Bean

Statement only · UnsolvedOriginal problem ↗

Jack has three plates in front of him. The giant has N beans that he distributes to the three plates. All the beans look the same, but one of them is a magic bean. Jack doesn't know which one it is, but the giant knows.

Jack can ask the giant questions of the form: "Does this subset of the beans contain the magic bean?" In each question Jack may choose any subset of beans from a single plate, and the giant will respond truthfully.

If the three plates contain a, b and c beans respectively, we let h(a,b,c) be the minimal number of questions Jack needs to ask in order to guarantee he locates the magic bean. For example, h(1,2,3)=3 and h(2,3,3)=4.

Let H(N) be the sum of h(a,b,c) over all triples of non-negative integers a, b, c with 1a+b+cN.
You are given: H(6)=203 and H(20)=7718.

A repunit, Rn, is a number made up with n digits all '1'. For example, R3=111 and H(R3)=1634144.

Find H(R19). Give your answer modulo 1000000007.

Write-up coming later

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