← Complete problem index

PROJECT EULER · #0759

A Squared Recurrence Relation

Statement only · SolvedOriginal problem ↗

The function f is defined for all positive integers as follows:

f(1)=1f(2n)=2f(n)f(2n+1)=2n+1+2f(n)+1nf(n)

It can be proven that f(n) is integer for all values of n.

The function S(n) is defined as S(n)=i=1nf(i)2.

For example, S(10)=1530 and S(102)=4798445.

Find S(1016). Give your answer modulo 1000000007.

Write-up coming later

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