Ponder This Challenge - May 2026 - The Powers of a Binary Matrix
- Ponder This
Continuing the theme of last month, we deal with a movie franchise consisting of superheroes. They are joined by supervillains. The producers intend to pair the superheroes and the supervillains to form (hero, villain) pairs where each hero has a unique villain serving as their nemesis.
Each pairing is accepted differently by the audiences. After elaborate work, a method of assigning numerical value to each pairing to estimate the audiences' reaction was developed. The producers wish to find the list of pairings that maximizes the value of the pairing with the minimal value in the list. This minimal value is called the hero-villain value.
The way is computed is as follows: Let be some prime and define a function . By setting and we obtain a sequence which eventually repeats. Let be the number of steps until the first repeat happens. i.e. if is the first element in the sequence such that there exists for which , then .
For example, for and , one possible list of pairings is which yields the values for which the minimum is 14. It turns out that every list of pairings gives a value of at most 14, so 14 is the superhero value for this case.
Your goal Find the superhero value for and
A bonus "*" will be given for finding the optimal in the range for which gives the maximal superhero value for and .