A Way to Be GoalOriented
Start at the number 3. Then, at each step, apply one of eight functions until, after the final step, you have reached the "goal" number in as few steps as necessary.
The eight functions you may use on a number x are:
f_{1}(x) = x+1
f_{2}(x) = x1
f_{3}(x) = wholenumber quotient when x^{2} is divided by 123
f_{4}(x) = remainder when x^{2} is divided by 123
f_{5}(x) = x + sod(x)
f_{6}(x) = x  sod(x)
f_{7}(x) = x + pod(x)
f_{8}(x) = x  pod(x)
To clarify: the notation sod(x) is the sum of the digits of x
in its base 10 representation, while the notation pod(x)
is the product of the digits of x (excluding
leading zeroes) in its base ten
representation. Now, each x can be represented
as 123×q + r, where q and r are positive integers
with r < 123. So, f_{3}(x) = q
and f_{4}(x) = r. All eight functions produce whole numbers if x is a natural number.
For example, if the goal is 148, one could do:
Step 1: f_{4} (3) = 9
Step 2: f_{5}(9) = 18
Step 3: f_{4}(18) = 78
Step 4: f_{7}(78) = 134
Step 5: f_{1}(134) = 135
Step 6: f_{3}(135) = 148
Of course, you could always apply f_{1}
over and over about 145 times. This would not, however, reach the goal in the fewest number of steps.
Starting at 3, get these goals in as few steps as
possible:
 20 (easy)
 129 (medium)
 271 (hard)
Note: The difficulty ratings were suggested by the problem's source. You may not agree.
Source: Puzzle & Riddle of Day, August 1, 2010
Hint: Nothing needed other than to roll up your sleeves and play with the different functions, getting a good feel for their effect. It is difficult to know the impact of some of the functions on their input, especially the last six functions.
Solution Commentary: If you start at 3 and reach a goal number, then great...but before moving on, see if you can reach this same goal using less steps.
Also, what do you think is the hardest goal to reach (<100)?
