superprismatic Posted August 1, 2010 Report Share Posted August 1, 2010 Start at the number 3. Then, at each step, apply one of eight functions until, after the final step, you have reached the target number. The four functions you may use are: f1(x) = x+1 f2(x) = x-1 f3(x) = the quotient when x2 is divided by 123 f4(x) = the remainder when x2 is divided by123 f5(x) = x+sod(x) f6(x) = x-sod(x) f7(x) = x+pod(x) f8(x) = x-pod(x) Note: sod(x) is the sum of digits of x in its base 10 representation. pod(x) is the product of digits of x (excluding leading zeroes) in its base ten representation. Now, x can be represented as 123×q+r, where q and r are integers with r<123. So, f3(x) would be q and f4(x) would be r. All of the eight functions produce integers. For example, if I had a target of 148, I could get there thusly: 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 Starting at 3, see if you can get to these targets in as few steps as possible: 1. 20 (easy) 2. 129 (medium) 3. 271 (hard) Of course, one could always apply f1 over and over. This would not, however, produce the fewest number of steps. Besides this would be like the wall-hugging technique to get through a standard 2 dimensional maze -- it works, but it is in no way optimal! Quote Link to comment Share on other sites More sharing options...
0 Guest Posted August 2, 2010 Report Share Posted August 2, 2010 f4(3) = 9 f7(9) = 18 f1(18) = 19 f1(19) = 20 f4(3) = 9 f4(6) = 81 f5(12) = 90 f4(21) = 105 f5(72) = 111 f5(81) = 114 f5(90) = 120 f5(99) = 123 f5(99) = 129 those are my preliminary guesses for now, ill try 271 later. Quote Link to comment Share on other sites More sharing options...
0 superprismatic Posted August 2, 2010 Author Report Share Posted August 2, 2010 f4(3) = 9 f7(9) = 18 f1(18) = 19 f1(19) = 20 f4(3) = 9 f4(6) = 81 f5(12) = 90 f4(21) = 105 f5(72) = 111 f5(81) = 114 f5(90) = 120 f5(99) = 123 f5(99) = 129 those are my preliminary guesses for now, ill try 271 later. Very Nice start! Quote Link to comment Share on other sites More sharing options...
0 Guest Posted August 2, 2010 Report Share Posted August 2, 2010 I have not confirmed if these are optimal as that might take some programming, of which I don't have the software. 1. f5(3) = f7(3) = 6 2. f4(6) = 15 3. f7(15) = 20 1. f4(3) = 9 2. f4(9) = f5(9) = f7(9) = 18 3. f4(18) = 78 4. f7(78) = 134 5. f6(134) = 126 6. f3(126) = 129 1. f4(3) = 9 2. f4(9) = f5(9) = f7(9) = 18 3. f4(18) = 78 4. f7(78) = 134 5. f1(134) = 135 6. f7(135) = 150 7. f3(150) = 182 8. f3(182) = 269 9. f1(269) = 270 10. f1(270) = 271 Quote Link to comment Share on other sites More sharing options...
0 Guest Posted August 2, 2010 Report Share Posted August 2, 2010 1. f4(3) = 9 2. f2(9) = 8 3. f4(8) = 64 4. f7(64) = 88 5. f7(88) = 152 6. f3(152) = 187 7. f3(187) = 284 8. f6(284) = 270 9. f1(270) = 271 Quote Link to comment Share on other sites More sharing options...
0 superprismatic Posted August 2, 2010 Author Report Share Posted August 2, 2010 I have not confirmed if these are optimal as that might take some programming, of which I don't have the software. 1. f5(3) = f7(3) = 6 2. f4(6) = 15 3. f7(15) = 20 1. f4(3) = 9 2. f4(9) = f5(9) = f7(9) = 18 3. f4(18) = 78 4. f7(78) = 134 5. f6(134) = 126 6. f3(126) = 129 1. f4(3) = 9 2. f4(9) = f5(9) = f7(9) = 18 3. f4(18) = 78 4. f7(78) = 134 5. f1(134) = 135 6. f7(135) = 150 7. f3(150) = 182 8. f3(182) = 269 9. f1(269) = 270 10. f1(270) = 271 Nice work (including your improvement for 271 in post#5)! You made a mistake in step 2 for the easiest one (20) though. Quote Link to comment Share on other sites More sharing options...
0 Guest Posted August 2, 2010 Report Share Posted August 2, 2010 1. f1(3) = 4 2. f4(4) = 16 3. f2(16) = 15 4. f7(15) = 20 1. f5(3) = f7(3) = 6 2. f5(6) = f7(6) = 12 3. f5(12) = 15 4. f7(15) = 20 1. f5(3) = f7(3) = 6 2. f5(6) = f7(6) = 12 3. f4(12) = 21 4. f2(21) = 20 1. f5(3) = f7(3) = 6 2. f4(6) = 36 3. f2(36) = 35 4. f8(35) = 20 1. f4(3) = 9 2. f5(9) = f7(9) = 18 3. f1(18) = 19 4. f1(19) = 20 Quote Link to comment Share on other sites More sharing options...
0 plainglazed Posted August 3, 2010 Report Share Posted August 3, 2010 Step 1 - f4(3) = 9 Step 2 - f4(9) = 81 Step 3 - f1(81) = 82 Step 4 - f7(82) = 98 Step 5 - f7(98) = 170 Step 6 - f5(170) = 178 Step 7 - f3(178) = 257 Step 8 - f5(257) = 271 Quote Link to comment Share on other sites More sharing options...
0 Guest Posted August 3, 2010 Report Share Posted August 3, 2010 (edited) This is the optimal solution. f1(3) = 4 f4(4) = 16 f2(16) = 15 f7(15) = 20 f5(3) = 6 f4(6) = 36 f2(36) = 35 f4(35) = 118 f7(118) = 126 f3(126) = 129 f4(3) = 9 f4(9) = 81 f1(81) = 82 f7(82) = 98 f7(98) = 170 f5(170) = 178 f3(178) = 257 f5(257) = 271 Edited August 3, 2010 by almus Quote Link to comment Share on other sites More sharing options...
Question
superprismatic
Start at the number 3. Then, at each
step, apply one of eight functions until,
after the final step, you have reached
the target number.
The four functions you may use are:
f1(x) = x+1
f2(x) = x-1
f3(x) = the quotient when x2 is divided by 123
f4(x) = the remainder when x2 is divided by123
f5(x) = x+sod(x)
f6(x) = x-sod(x)
f7(x) = x+pod(x)
f8(x) = x-pod(x)
Note: sod(x) is the sum of digits of x
in its base 10 representation. pod(x)
is the product of digits of x (excluding
leading zeroes) in its base ten
representation. Now, x can be represented
as 123×q+r, where q and r are integers
with r<123. So, f3(x) would be q
and f4(x) would be r. All of
the eight functions produce integers.
For example, if I had a target of 148,
I could get there thusly:
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
Starting at 3, see if you can get to
these targets in as few steps as
possible:
1. 20 (easy)
2. 129 (medium)
3. 271 (hard)
Of course, one could always apply f1
over and over. This would not, however,
produce the fewest number of steps.
Besides this would be like the
wall-hugging technique to get through
a standard 2 dimensional maze -- it
works, but it is in no way optimal!
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.