← Complete problem index

PROJECT EULER · #0340

Crazy Function

Statement only · UnsolvedOriginal problem ↗

For fixed integers a,b,c, define the crazy function F(n) as follows:
F(n)=nc for all n>b
F(n)=F(a+F(a+F(a+F(a+n)))) for all nb.

Also, define S(a,b,c)=n=0bF(n).

For example, if a=50, b=2000 and c=40, then F(0)=3240 and F(2000)=2040.
Also, S(50,2000,40)=5204240.

Find the last 9 digits of S(217,721,127).

Write-up coming later

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