← Complete problem index

PROJECT EULER · #0555

McCarthy 91 Function

Statement only · UnsolvedOriginal problem ↗

The McCarthy 91 function is defined as follows: M91(n)={n10if n>100M91(M91(n+11))if 0n100

We can generalize this definition by abstracting away the constants into new variables: Mm,k,s(n)={nsif n>mMm,k,s(Mm,k,s(n+k))if 0nm

This way, we have M91=M100,11,10.

Let Fm,k,s be the set of fixed points of Mm,k,s. That is, Fm,k,s={nN|Mm,k,s(n)=n}

For example, the only fixed point of M91 is n=91. In other words, F100,11,10={91}.

Now, define SF(m,k,s) as the sum of the elements in Fm,k,s and let S(p,m)=1s<kpSF(m,k,s).

For example, S(10,10)=225 and S(1000,1000)=208724467.

Find S(106,106).

Write-up coming later

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