This question doesn't support checking answers.
555. McCarthy 91 function

Publish Date:

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 $M_{91} = M_{100,11,10}$.

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

For example, the only fixed point of $M_{91}$ is $n = 91$. In other words, $F_{100,11,10}= \{91\}$.

Now, define $SF(m,k,s)$ as the sum of the elements in $F_{m,k,s}$ and let $S(p,m) = \displaystyle \sum_{1 \leq s < k \leq p}{SF(m,k,s)}$.

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

Find $S(10^6, 10^6)$.

Press F12 and use the "Console" tab to view the output of your codes.

Loading...