Home > Problem of the Week > Archive List > Detail

<< Prev 10/17/2010 Next >>

A Way to Be Goal-Oriented

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:

  • f1(x) = x+1
  • f2(x) = x-1
  • f3(x) = whole-number quotient when x2 is divided by 123
  • f4(x) = remainder when x2 is divided by 123
  • f5(x) = x + sod(x)
  • f6(x) = x - sod(x)
  • f7(x) = x + pod(x)
  • f8(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 123q + r, where q and r are positive integers with r < 123. So, f3(x) = q and f4(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: f4 (3) = 9
    Step 2: f5(9) = 18
    Step 3: f4(18) = 78
    Step 4: f7(78) = 134
    Step 5: f1(134) = 135
    Step 6: f3(135) = 148

    Of course, you could always apply f1 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:

    1. 20 (easy)
    2. 129 (medium)
    3. 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)?