← Complete problem index

PROJECT EULER · #0648

Skipping Squares

Statement only · UnsolvedOriginal problem ↗

For some fixed ρ[0,1], we begin a sum s at 0 and repeatedly apply a process: With probability ρ, we add 1 to s, otherwise we add 2 to s.

The process ends when either s is a perfect square or s exceeds 1018, whichever occurs first. For example, if s goes through 0,2,3,5,7,9, the process ends at s=9, and two squares 1 and 4 were skipped over.

Let f(ρ) be the expected number of perfect squares skipped over when the process finishes.

It can be shown that the power series for f(ρ) is k=0akρk for a suitable (unique) choice of coefficients ak. Some of the first few coefficients are a0=1, a1=0, a5=18, a10=45176.

Let F(n)=k=0nak. You are given that F(10)=53964 and F(50)842418857(mod109).

Find F(1000), and give your answer modulo 109.

Write-up coming later

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