Jump to content
BrainDen.com - Brain Teasers
  • 0


superprismatic
 Share

Question

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

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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 by almus
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...