Publish Date:
The McCarthy 91 function is defined as follows:
We can generalize this definition by abstracting away the constants into new variables:
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,
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.