Getting to 17

Starting from the number 1, your goal is to get to the number 17 using only these actions:

  • add 1, or
  • multiply by 3.

What is the minimum number of actions it takes to get to 17?

5 6 7 8 9

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.

20 solutions

Geoff Pilling
Nov 8, 2018

Starting with 1:

  • × 3 = 3 \times 3 = 3
  • + 1 = 4 + 1 = 4
  • + 1 = 5 + 1 = 5
  • × 3 = 15 \times 3 = 15
  • + 1 = 16 + 1 = 16
  • + 1 = 17 + 1 = 17

6 steps!

This is more intuitive if you think in base 3, where multiplying by 3 is the same as adding a 0 to the end.

1 7 10 = 12 2 3 17_{10} = 122_3

Very interesting! I never would've thought about this in terms of bases. I feel like this is a really good way to introduce different number bases.

Blan Morrison - 2 years, 7 months ago

Log in to reply

Thanks... Yeah, it seems to give some motivation as to why we might want to consider other bases besides 10, 2 and 8, and 16.

Geoff Pilling - 2 years, 7 months ago

I agree! I stumbled upon the 6 step solution, but the base 3 argument makes it really clear why it's optimal.

William Allbritain - 2 years, 7 months ago

I used *.if you know your times table you should get this one easy:)

Ris Neps - 1 year, 9 months ago

Due to my carelessness, I mistakenly thought it’s “add 3” instead of multiplying and still got 6 turns... Quite coincidence

E O - 2 years, 7 months ago

Log in to reply

I dont know what the hex I did because I that was exactly how I did it but some how counted 8 moves in my head...Thats what I get for not writing it out....ooops

Tifaine Bowen - 2 years ago

You can do it "reverse", if it is a multiple of 3, then divide by 3.

17 1 1 = 15 , 15 / 3 = 5 , 5 1 1 = 3 , 3 / 3 = 1 17-1-1=15, 15/3=5, 5-1-1=3, 3/3=1

Really similar with the base 3 method.

X X - 2 years, 7 months ago

Log in to reply

Yes, it is the same method that I used

Diego Salcedo Tolosa - 2 years, 5 months ago

Log in to reply

Brilliant method

Anushka Saraswat - 2 years, 5 months ago

wow it's so simplistic amazing

amir g - 2 years, 2 months ago

I did the same

Bobby Conrado - 2 years, 2 months ago

how is 122 in base 3 suggesting the solution? you mean only considering units place and the hundreth place, what about 2*3^1 in tens place ( Terms in decimal system)

Sunil Nandella - 2 years, 5 months ago

Log in to reply

It’s perhaps not immediately obvious but I think it’s an ingenious approach... the target is 122 in base 3, so the steps would be:

1 ... we have the first digit of the target, so the next step should be to multiply by 3

1 * 3 = 10

10 + 1 = 11

11 + 1 = 12 ... this gives the first two digits of the target, so multiply by 3 again

12 * 3 = 120

120 + 1 = 121

121 + 1 = 122

Rather than just using trial and error we can see when to multiply and when to add.

Robert Williams - 2 years, 5 months ago

Log in to reply

quite interesting.

Sunil Nandella - 2 years, 5 months ago

Log in to reply

@Sunil Nandella thank you is this representation leading to some other subject. It cant be just this vague problem.

Sunil Nandella - 2 years, 5 months ago

This is beautiful, mind blown 🤯

Karen Martinez - 2 years, 5 months ago

I had the exact thing, except I didn't realize I started with one.

Half-god Dragon - 2 years, 5 months ago

Log in to reply

Same here, I answered 7.

CubieCuber Clode - 2 years, 5 months ago

*3 +1 +1 +1 *3 +1

A Former Brilliant Member - 2 years, 5 months ago

Log in to reply

This yields 19.

Félix Pérez Haoñie - 2 years, 5 months ago

i got the answer but i counted the step wrongπ_π

Wong Chu Yin - 2 years, 5 months ago

I really thought it was 7, but thank you for showing me the right way, I really appreciate it.

Jaylen Thornton - 2 years, 5 months ago

.×3=3+1=4×(3+1)=16+1=17=5 steps

Daniel Pereyra - 2 years, 5 months ago

Log in to reply

I guess that your way isn't well at all beacuse you're multiplying 4 4 (4 (3+1)) and that's not a valid way...

Josue Pimentel - 2 years, 5 months ago

ahh, I just didn't think to try adding another one in the beginning, so I got 7

Isaiah Baughman - 2 years, 5 months ago

umm... I didn't get the base 3 thing ..

Fathoor Rabbani - 2 years, 5 months ago

Log in to reply

"multiplying by 3 is the same as adding a 0 to the end" So...you start with 1, and know your goal ist 122. So first you add a 0 to the end, to get 10 (i.e. multiply by the base, which is 3). You add 1 to get 11, another 1 for 12, multiply again for 120, and add two 1 again. This way u don't have to consider "first add? Two multiply in a row?", the structure of the goal 122 makes it easier to think.

Phil Ipp - 2 years, 5 months ago

5 steps: 1+3=4 4+1=5 5*3=15 15+1=16 16+1=17

Todd Smith - 2 years, 5 months ago

Log in to reply

U can only add by 1 or multiply by 3

Saad Benmansour - 2 years, 5 months ago

You added 3 the first time instead of multiplying by 3 so the steps would be: 1 3=3 3+1=4 4+1=5 5 3=15 15+1=16 16+1=17

Cat Mccat - 2 years, 5 months ago

Going base 3 is suitable for any number, not just 17.

Having a look at the base3 number: - Number of multiplications = digit count - 1 - Number of additions = sum of digits.

In this task, the initial number is 1 (instead of "normal" 0), so take an addition to get the correct result.

So base 3 form of 17 is 122, like mentioned by Geoff. So number of multiplications=2 Number of additions=5 (but this time, just 4 because of the starting number)

Gabor Vesa-Antti Vekony - 2 years, 5 months ago

I thought it was 7 but I forgot we were starting at 1, not 0

Amaya Todd - 2 years, 5 months ago

Log in to reply

Lol I did the same thing

Christian Mann - 2 years, 5 months ago

Got 7, then decide the world will always do 1 better, so guessed 6.

Golden Standard - 2 years, 5 months ago

I also thought seven because I skimmed the part of starting at 0. ;-;

Isobel Campbell - 2 years, 5 months ago

Same As I did

G Arora - 2 years, 5 months ago

the updated version of brilliant.org is so boring

Mohammad Khaza - 2 years, 4 months ago

Log in to reply

In what way?

Geoff Pilling - 2 years, 4 months ago

Log in to reply

where is the follower option????

u can't search for anyone or any members.

i mean the interaction has become very backdated

[it is just my opinion]

Mohammad Khaza - 2 years, 4 months ago

What's this base thing? I understood that 6 steps it was quite easy

Shourin Aysha - 2 years, 3 months ago

The fastest solution is to get to 5 and then multiply by 3.This solution use 3 steps to get to 5.If you add 1 four times,you have to use four steps to get to 5.

Eric Jonson - 2 years, 1 month ago

Nolp . I do not understand ...

Choo Yue Jia - 2 years ago
D H
Nov 8, 2018

The biggest constraint is that we should include 5 × 3 5 \times 3 since that is the biggest step. The fastest way to get to 5 5 is 1 × 3 + 1 + 1 = 5 1 \times 3 + 1 + 1 = 5 . After 5 × 3 = 15 5 \times 3 = 15 , the only way to 17 17 from here is 1 + 1 1 + 1 , giving a total of 6 \boxed{6} turns

1+3*5=16....3 steps 16+1 = 17....That is one extra step steps. Total: is 4 Operations in the Equation.

The information provided states ONLY: " start with 1" The only actions permitted are:

" add 1" or "multiply by 3".

Other than that there are no restrictions as to HOW one gets to 17 There is no restriction on the "multiply by 3" . . .it means 3 x. . . .It does NOT mean x 3 Using x=5 gives the minimum number of steps to get to 17 with 4 steps. There is no restriction on setting x=5.

Other than the above, If "starting with 1" is counted as an " operational step then the minimum number of operations = 5.

Conrad Winkelman - 2 years, 5 months ago

This explanation was useful and helpful!🤩

Anaya Douglas - 2 years, 4 months ago
Michael Kan
Dec 16, 2018

Apply reverse thinking in finding the answer.

It is equivalent to find how to get to 1 from 17, using -1 and ÷3.

The advantage is that you can easily determine if ÷3 can be used, by checking the divisibility of 3.

Hence,

17-1=16

16-1=15, which is divisible by 3.

15÷3=5

5-1=4

4-1=3, which is divisible by 3.

3÷3=1

Therefore, 6 steps are required at least.

I like this backtracking approach. It is clear why it results in the lowest number of steps. Namely, if you don't use the divide by 3 function when you can, it definitely takes more steps.

To me, the top answer does not really provide this proof, although given this answer, it is clear why the base-3 approach should work. In other words, this answer provided the proof I was missing for the top answer.

Roland van Vliembergen - 2 years, 5 months ago

Brilliant!

David Stiff - 2 years, 5 months ago

That is actually my favorite method for this question

Muzahidul Islam - 2 years, 2 months ago
Arjen Vreugdenhil
Dec 20, 2018

General solution

Write the final number in ternary (base 3) notation. Let N N be the number of ternary digits and S S the sum of the digits. Then the minimum number of steps is X = S + N 2. X = S + N - 2. In this case, 1 7 10 = 12 2 3 17_{10} = 122_3 , so that N = 3 N = 3 , S = 1 + 2 + 2 = 5 S = 1 + 2 + 2 = 5 and X = 3 + 5 2 = 6 X = 3 + 5 - 2 = \boxed{6} .

Reasoning

In ternary notation, the two operations we are allowed are:

  • adding one to the final digit

  • shifting all digits left (i.e. add a zero to the end)

We build the number digit by digit. The number of additions we must perform is one less than the digit sum, A = S 1 A = S - 1 . (One less, because we are given 1 at the beginning.)

The number of multiplications is one less than the number of digits, M = N 1 M = N - 1 . (One less, because we start with one digit.)

Adding gives A + M = S + N 2 A + M = S + N - 2 .

The only thing missing in this approach is the proof that this is indeed the minimum. The basic idea of this proof is that any sequence of three or more additions can be replaced by something more efficient. Thus, M A A A A M MAAA \mapsto AM .

Fantastic explanation, thx!

Milton X - 1 year, 8 months ago

Let's reason backwards and consider every possible case:

Let A n A_n be the set of numbers from which you can reach 17 17 in n n moves:

  • A 0 = { 17 } A_0 = \left\{ 17 \right\} (duh!)

  • A 1 = { 16 } A_1 = \left\{ 16 \right\} (17 is reachable only from 16)

  • A 2 = { 15 } A_2 = \left\{ 15 \right\} (16 is reachable only from 15)

  • A 3 = { 5 , 14 } A_3 = \left\{ 5, 14 \right\} (15 is reachable from either 5 or 14, because it's a multiple of 3)

  • A 4 = { 4 , 13 } A_4 = \left\{ 4, 13 \right\} (5 is reachable from 4; 14 from 13)

  • A 5 = { 3 , 12 } A_5 = \left\{ 3, 12 \right\} (4 is reachable from 3; 13 from 12)

  • A 6 = { 1 , 2 , 4 , 11 } A_6 = \left\{ 1, 2, 4, 11 \right\} (3 is reachable from either 1 (yay!) or 2; 12 from either 4 or 11)

So the minimum number of moves is 6 6 .

Translating my intuitive solution into solving a graph theory problem. Nice!

Milton X - 1 year, 8 months ago

We let A ( n ) A(n) to be the minimum number of actions needed. If we think intuitively, the recursive form of A ( n ) A(n) is A ( n ) = { A ( n 1 ) + 1 if n > 1 and is indivisible by 3 min ( A ( n / 3 ) + 1 , A ( n 1 ) + 1 ) if n > 1 and is divisible by 3 0 if n = 1 A(n)= \begin{cases} A(n-1)+1 & \text{if } n>1 \text{ and is indivisible by 3}\\ \text{min}(A(n/3)+1, A(n-1)+1) & \text{if } n>1 \text{ and is divisible by 3}\\ 0 & \text{if } n=1 \end{cases} Of course, A ( n / 3 ) A(n/3) might be a greater choice for the value to be minimum than A ( n 1 ) A(n-1) , but you also want to know why it's true. An important observation here is that, for any three consecutive integers there must exists a number among them which is divisible by 3 3 . That can be proven by induction.

Then, if n / 3 n/3 (assuming n n is divisible by 3 3 ) is an another integer indivisible by three then either n / 3 1 n/3-1 or n / 3 2 n/3-2 must be divisible by three, in this case it seems like this is a great case for minimizing the number of actions by doing either A ( ( n / 3 1 ) / 3 ) A((n/3-1)/3) or A ( ( n / 3 2 ) / 3 ) A((n/3-2)/3) . If n / 3 n/3 is also divisible by three (which is another luck), we can just do A ( ( n / 3 ) / 3 ) A((n/3)/3) . (In fact, this is more likely a "greedy approach".)

From this observation, we transform A ( n ) A(n) to be A ( n ) = { A ( n 1 ) + 1 if n > 1 and is indivisible by 3 A ( n / 3 ) + 1 if n > 1 and is divisible by 3 0 if n = 1 A(n)= \begin{cases} A(n-1)+1 & \text{if } n>1 \text{ and is indivisible by 3}\\ A(n/3)+1 & \text{if } n>1 \text{ and is divisible by 3}\\ 0 & \text{if } n=1 \end{cases}

and the result is A ( 17 ) = A ( 16 ) + 1 = A ( 15 ) + 2 = A ( 5 ) + 3 = A ( 4 ) + 4 = A ( 3 ) + 5 = A ( 1 ) + 6 = 6 . A(17) = A(16) + 1 = A(15) + 2 = A(5) + 3 = A(4) + 4 = A(3) + 5 = A(1) + 6 = \boxed{6}. Backtracking always helps.

Johanan Paul
Dec 17, 2018

I started from 17 and turned it into 1. The rules would be "subtract 1" and "divide by 3". Since division is more 'stricter' than multiply, I would be forced to reach a multiple of 3 by subtracting first.

  • subtract 1 ( 17 1 = 16 ) (17-1 = 16)
  • subtract 1 ( 17 1 = 15 ) (17-1 = 15)
  • divide by 3 ( 15 / 3 = 5 ) (15/3 = 5)
  • subtract 1 ( 5 1 = 4 ) (5-1 = 4)
  • subtract 1 ( 4 1 = 3 ) (4-1 = 3)
  • divide by 3 ( 3 / 3 = 1 ) (3/3 = 1)
Juan Farias
Dec 22, 2018

The best way I could see approaching this problem is by thinking of it as a graph problem. The root node is 1 and every child child is reached by either multiplying by 3 or adding 1 to the previous node. So that the v i + 1 v_{i+1} -th node is either 3 v i 3 v_{i} or v i + 1 v_{i}+1 . The easiest way to traverse the tree and determine bad paths is by either reaching a node which could have otherwise been traversed faster, or by taking the biggest step possible at each iteration.

We can formulate a similar problem by thinking of 3 n + 1 = 17 3n+1=17 which yields 5R1. This gives us an idea of how close we can get by multiplication alone. The idea then is to get to 5 in the least amount of moves as possible, then to 15, then to 17.

3+1=4 4+1=5 5*3=15 15+1=16 16+1=17 It is only 5 steps I don't understand how I am the only one who realised it

Tanvir-Hassan kazi - 2 years, 5 months ago

Log in to reply

You are not the only one :))

Catalin Maria - 2 years, 2 months ago
은주 황
Nov 9, 2018

((1×3)+1+1)×3+1+1=17. So the total is 6 turns.

Hriday Gupta
Jan 1, 2019

why just not thinking that a number obtained on multiplying by 3 must be a multiple of 3! So all you need to do is generate multiples of 3 by reducing 17 by one which would yield 15! now divide by 3 to get 5 subtract 1 two times n divide by 3

the problem appears easy here but I think the smart mathematicians must try for 6565 this might outsmart you;)

Manos Kavou
Dec 23, 2018

The closer number to 17 which you can multiply by 3 is 15.

I thought the same as you.

Hong Kay - 2 years, 4 months ago
Richard Desper
Dec 22, 2018

Equivalent problem: starting at 17 17 , make way to 1 1 using one of two operations: n n 1 n \rightarrow n-1 or n n / 3 n \rightarrow n/3 . In this case, division can only be used at multiples of 3 3 , so the first two steps have to be subtraction. Next, observe that a greedy strategy is optimal, since it's faster to divide by 3 3 and subtract 1 1 (two steps) than subtract 3 3 and then divide by 3 3 (four steps).

Thus the optimal path is 17 16 15 5 4 3 1 17 \rightarrow 16 \rightarrow 15 \rightarrow 5 \rightarrow 4 \rightarrow 3 \rightarrow 1

Stephon Henry
Dec 19, 2018

I found it helpful to work backwards from 17. Since 17 and 16 are not divisible by 3, you will not reach those values directly by multiplying by 3. This means that that the last two steps are going to be adding 1 to some number. When we get to 15, that is thankfully divisible by 3, so we can get to the number 5 by dividing 15 by 3. Following the same logic, we subtract one to get to 4, then 3. Dividing 3 by 3, we get back to 1 which was the starting point. Counting the steps here, it is six steps.

I tried to come up with another solution that would give a smaller amount but nothing worked lol.

Rida Khan
Dec 19, 2018

You can do this, it is very simple if you think about it. Starting with 1: - 1 x 3 = 3 (Step 1) - 3 + 1 = 4 (Step 2) - 4 + 1 = 5 (Step 3) - 5 x 3 = 15 (Step 4) - 15 + 1 = 16 (Step 5) - 16 + 1 = 17 (Step 6) 6 Steps in total! don't make it too confusing but don't make it too easy for yourself.

Geff Lanz
Dec 19, 2018

This is really easy to figure out if you solve the problem backward. Start at 17 and try to reach 1 with the actions reversed (subtract 1, or divide by 3). Since the goal now is to reach 1 in the fewest # of actions, you should simply divide by 3 whenever you can, which is when your current number is divisible by 3, and subtract by 1 when it is not:

Start at 17 (not divisible by 3)

  1. Subtract 1 = 16 (not divisible by 3)
  2. Subtract 1 = 15 (divisible by 3)
  3. Divide by 3 = 5 (not divisible by 3)
  4. Subtract 1 = 4 (not divisible by 3)
  5. Subtract 1 = 3 (divisible by 3)
  6. Divide by 3 = 1

So the minimum # of actions is 6!

Caleb Nasiatka
Dec 18, 2018

Think about the biggest number you can multiply by 3 and get under 17. Then figure out the fastest way to get to that number. 5X3=15 but 6X3=18 so you choose 5 and figure out that you can get to 3 in one step by 1X3 then add 2, multiply by 3, and add 2!

Ahlam Mahi
Dec 17, 2018

First :1+1=2, 2*3 =6

Bad path. Since 6*3 = 18, if you go up to 6 you can never multiply by 3 again. So you would have to add 1 eleven more times.

Richard Desper - 2 years, 5 months ago
Peter Macgregor
Dec 17, 2018

We can work backwards, reducing the total either by subtracting one (which we can always do) or by dividing by three (which we can do only if our current total is a multiple of three).

We must start off

17 16 15 17 \rightarrow 16 \rightarrow 15

now we have a choice. *.The obvious thing to do is to divide by three, and continue

17 16 15 5 4 3 1 17 \rightarrow 16 \rightarrow 15 \rightarrow 5 \rightarrow 4 \rightarrow 3 \rightarrow 1

Running this backwards exhibits a solution in 6 steps \boxed{\text{6 steps}} . (Obviously we reject the continuation 3 2 1 3 \rightarrow 2 \rightarrow 1 as inferior to 3 1 3 \rightarrow 1 )

To complete our solution we must show that this is the best possible chain of operations. It is just possible that if we had taken the other choice at * it would have switched us onto a better track. Let's check it out and see

17 16 15 14 13 12 11 or 4 17 \rightarrow 16 \rightarrow 15 \rightarrow 14 \rightarrow 13 \rightarrow 12 \rightarrow 11 \text{ or } 4

At this point we already have six steps, but we have not reached 1 yet, so we cannot find a better solution by this route.

Omar Balbuena
Dec 16, 2018

I easily completed it by doing it in reverse order counting the steps:

  • 17 – 1
  • 16 – 1
  • 15 ÷ 3
  • 5 – 1
  • 4 – 1
  • 3 ÷ 3
  • 1

Total steps: 6.

Vivek Sharma
Dec 20, 2018

1 X 3 3+1 4+1 5 X 3 15 +1 16 + 1 = 17 Six steps

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...