Tyler has two calculators, both of which initially display zero. The first calculator has only two buttons, and . The second has only the buttons and . Both calculators update their displays immediately after each keystroke.
A positive integer is called ambivalent if the minimum number of keystrokes needed to display on the first calculator equals the minimum number of keystrokes needed to display on the second calculator. Find the last three digits of the smallest ambivalent number.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
My python code using dynamic programming.