Problem 5
Let be a positive integer. A Japanese triangle consists of circles arranged in an equilateral triangular shape such that for each , the -th row contains exactly circles, exactly one of which is colored red. A ninja path in a Japanese triangle is a sequence of circles obtained by starting in the top row, then repeatedly going from a circle to one of the two circles immediately below it, and finishing in the bottom row. In terms of , find the greatest such that in each Japanese triangle there is a ninja path containing at least red circles.
Step 3 of 5: Count the best partial path recursively
In plain words
The largest number of red circles reachable by any partial ninja path ending at a given circle only depends on the two best partial paths ending at its two possible predecessors.
Detailed analysis
For any Japanese triangle, let denote the greatest number of red circles on a ninja-path segment from the top circle down to the circle in position of row (with if that position does not exist). Since every path through arrives from or , if is red, and otherwise.