Sum of Powers of Three

What is the 50th smallest positive integer that can be written as the sum of one or more distinct powers of 3 with non-negative integer exponents?


The answer is 327.

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.

7 solutions

Notice that 2 × 3 j < 3 j + 1 2\times3^j<3^{j+1} . This implies that i = 0 j 3 i < 3 j + 1 \displaystyle\sum_{i=0}^j3^i<3^{j+1} . This means that the function which accepts a binary integer a j a j 1 a 1 a 0 2 \overline{a_ja_{j-1}\dots a_1a_0}_2 and returns i = 0 j a i × 3 i \displaystyle\sum_{i=0}^ja_i\times3^i is a strictly increasing function. The binary representation of 50 is 11001 0 2 110010_2 , so the 50th smallest positive integer that can be written as the sum of distinct non-negative integer powers of 3 is 3 5 + 3 4 + 3 1 = 327 3^5+3^4+3^1=327 .

[Slight edits for clarity - Calvin]

Calvin Lin Staff
May 13, 2014

Consider the base 3 representation of all such elements. Since all the powers are distinct, they consist of the numbers 1 or 0. Thus, there is a bijection between such numbers, and the natural numbers written in binary, by changing the base from 3 3 to 2 2 , and vice versa. This function is an increasing function, so to find the 50th smallest number, we take 50 = 11001 0 2 50 =110010_2 , and convert it to ternary to obtain 11001 0 3 = 243 + 81 + 3 = 327 110010_3 = 243 + 81 + 3= 327 .

The problem requires that the integer be written as the "sum of distinct powers of 3." Can we think of 3^n as sum of distinct powers of 3?

Sungil Cho - 5 years, 11 months ago

Log in to reply

That's a good question. Can 3 n 3^n be written as the sum of distinct powers of 3? If so, how?

Calvin Lin Staff - 5 years, 11 months ago

Log in to reply

No, it can't! k = 0 n 1 3 k = 3 n 1 2 < 3 n . \sum_{k = 0}^{n-1} 3^k = \frac{3^n-1}{2} < 3^n.

Arjen Vreugdenhil - 5 years, 8 months ago

Well, can't think of 3 n 3^n , but it is possible to write every integer as a sum or difference of distinct powers of 3.

Satyajit Mohanty - 5 years, 10 months ago

say N=3^x1 + 3^x2 +....+ 3^xn & x1<x2<...<xn

N=3^x1 . (1+3k)
where 3k=3^(x2-x1)+....+3^(xn-x1) clearly a multiple of 3

hence 3k+1 is not a multiple of 3 ===>N can't be a pure power of 3

Sabarinath M S - 5 years, 7 months ago

Well it says "sum of one or more" ...

(Or has the wording been changed in the last few months? I can't tell from looking at the problem.)

Peter Byers - 5 years, 6 months ago

Is it possible that this question is ambiguously worded? Here is another way to see the '50 smallest', and the 50th is 757.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
1 1 1
2 3 10
3 4 11
4 9 100
5 10 101
6 12 110
7 13 111
8 27 1000
9 28 1001
10 30 1010
11 31 1011
12 36 1100
13 37 1101
14 39 1110
15 81 10000
16 82 10001
17 84 10010
18 85 10011
19 90 10100
20 91 10101
21 93 10110
22 108 11000
23 109 11001
24 111 11010
25 117 11100
26 243 100000
27 244 100001
28 246 100010
29 247 100011
30 252 100100
31 253 100101
32 255 100110
33 270 101000
34 271 101001
35 273 101010
36 279 101100
37 324 110000
38 325 110001
39 327 110010
40 333 110100
41 351 111000
42 729 1000000
43 730 1000001
44 732 1000010
45 733 1000011
46 738 1000100
47 739 1000101
48 741 1000110
49 756 1001000
50 757 1001001 

Bill Bell - 5 years, 9 months ago

Log in to reply

You're missing a bunch:

  • 40 (1111)
  • 94 (10111)
  • 112 (11011)
  • 118 (11101)
  • 120 (11110)
  • 121 (11111)
  • 256 (100111)
  • 274 (101011)
  • 280 (101101)
  • 282 (101110)
  • 283 (101111)

Inserting these 11 solutions shows that your 39th solutions is in fact the 50th!

Arjen Vreugdenhil - 5 years, 8 months ago

Log in to reply

Thanks. I tripped over my own feet.

Bill Bell - 5 years, 8 months ago

Gah, I forgot to take into account 3 0 3^0

Hung Woei Neoh - 5 years, 1 month ago

same thought sir

Abdullah Ahmed - 5 years, 1 month ago

This is the method I used and I like it the most because it is simple unlike other solutions that make use of weird symbols.

Shubham Bhargava - 5 years, 9 months ago

Sir why can't this combination of powers should be used. 3^0+3^1^0+3^1^1+3^1^2+.....+3^1^49 whose sum comes out to be 148.

Azmat Arshi - 5 years, 3 months ago
Rishav Roy
May 20, 2014

The natural number can be represented as 3 x 1 + 3 x 2 + . . . + 3 x n 3^{x1}+3^{x2}+...+3^{xn} where x1<x2<...<xn. First consider all the natural numbers which have 3^xn in their representation as the highest power of 3. The no. of such numbers = nC0+nC1+nC2+...+nCn=2^n. Let us call the group of such numbers as n-bracket. Apart from these brackets we have one more element i.e. 3^0=1. Now we arrange the brackets in the ascending order of their S.No. i.e. 1,1-bracket,2-bracket,... smallest element of n-bracket=3^n. Largest element of (n-1)-bracket= 3 1 + 3 2 + . . . + 3 n 1 = 3 n 3 2 3^1+3^2+...+3^{n-1}=\frac {3^n-3}{2} which is smaller than 3^n. So as a whole the (n-1)-bracket is smaller than the n-bracket. So by arranging the individual elements of all the brackets and by arranging the brackets serial wise we will actually arrange all the elements in a sorted manner. No. of elements before n-bracket= 1 + 2 1 + 2 2 + . . . . + 2 n 1 = 2 n 1 1+2^1+2^2+....+2^{n-1}=2^n-1 . Interestingly, all the elements(except 3^n) of n-bracket can be obtained by adding 3^n to all the elements of the preceding brackets i.e. 1-bracket, 2-bracket,...,(n-1)-bracket. .......(1) Now, suppose we wish to find the k-th smallest number. In order to find the bracket to which the number belongs find n such that 2 n n u m b e r 2 n + 1 1 2^n \leq number \leq 2^{n+1}-1 . The number belongs to n-bracket. After finding the bracket we only have to find the k-(2^n-1)th smallest number in the bracket. ........(2) Using fact (1) we can again break the n-bracket into its constituent brackets by ignoring 3^n. Once we find the number of the correct order we will simply add 3^n to it. ........(3) Care must be taken that after applying steps (2) and (3) once, we will have to look for (k-2^n)th smallest number in the smaller brackets. ........(4) We can reduce our search space by recursively using steps (2) & (3). But we need to define a reference point where we will end our recursive process. Let us have the following reference(sorted in ascending order): 1)0(in order to accommodate 3^n). 2)1 3)3 4)4 (1-bracket) 5)9 6)10 7)12 8)13 (2-bracket) So, if in our recursive process we are required to find the m-th smallest number ( 1 m 7 ) (1\leq m \leq 7) we simply look for the number corresponding to m-th serial number in the above reference list and accordingly add powers of 3 to it(as was stated in step 3). Care must be taken if the starting value of k is less than 9. In that case we should look for the (k+1)th element from the reference list. In case of k=8 the required number will obviously be 3^3=27. Now we pick up our case i.e. we find the 50th smallest number. note that 2 5 50 2 6 1 2^5 \leq 50 \leq 2^6-1 . So, the 50th smallest number is in 5-bracket. Now 50 ( 2 5 1 ) = 19 a n d 2 4 19 2 5 1 50-(2^5-1)=19 and 2^4 \leq 19 \leq 2^5-1 . Inside the 5-bracket 50th smallest number is in the 4-bracket at the 19 2 4 = 3 p o s i t i o n 19-2^4=3 position . We reach the terminating condition 3 corresponds to 3. So, our required number is 3 5 + 3 4 + 3 = 327 3^5+3^4+3 = 327 .

It seems to me that the smallest is equal to 1, which corresponds to 3^0 rather than 3^1. As the 1st smallest corresponds to the binary representation of 0, the 50th smallest should correspond to the binary representation of 49, not 50. The correct answer should therefore be 3^5 + 3^4 + 3^0 = 325.

Eric Dallal - 4 years, 10 months ago
Parth Lohomi
Nov 15, 2014

T h e r e p r e s e n t a t i o n o f t h e 50 t h s m a l l e s t s u c h n u m b e r w i l l The\ representation\ of\ the\ 50th\ smallest\ such\ number\ will

t h e r e f o r e b e t h e s a m e a s t h e r e p r e s e n t a t i o n o f t h e n u m b e r 50 i n therefore\ be\ the\ same\ as\ the\ representation\ of\ the\ number\ 50\ in

b a s e 2 base\ 2

5 0 10 50_{10} = 11001 0 2 110010_{2}

11001 0 3 110010_{3} = 3 5 + 3 4 + 3 1 = 32 7 10 3^{5} + 3^{4} + 3^{1} = \boxed{327_{10}}

Christine Gamble
May 20, 2014

Realised that each power of three can have all previously worked out answers added to it to make a new valid answer. Thirty-second value is 243 (3 to power 5) then find 18th number in original sequence (84) to add on

Kee Wei Lee
May 20, 2014

Since we need the sum as of powers of 3, it can be written as a n = [ b 0 ] 3 0 + [ b 1 ] 3 1 + . . . + [ b l ] 3 l a_n=[b_0]*3^0+[b_1]*3^1+...+[b_l]*3^l , where a n a_n is the nth smallest number possible and that b k b_k (for any real k )= 0 or 1. To get the correct combination of { b 0 , . . . , b l b_0,...,b_l } for each a n a_n , we need to write n in terms of base 2. Now 50 in base 2=110010, so b 5 = 1 , b 4 = 1 , b 3 = 0 , b 2 = 0 , b 1 = 1 b_5=1, b_4=1, b_3=0, b_2=0, b_1=1 and b 0 = 0 b_0=0 and b m = 0 b_m=0 for m>5. So a 50 = 3 5 + 3 4 + 3 = 327 a_{50}=3^5+3^4+3=327

Sabarinath M S
Oct 25, 2015

I did it just like Calvin said..

N=a0.3^0 +a1.3^1+a2.3^2+....+an.3^n+.....
ai=0 or 1 (ai-->i'th coefficient of above polynomial)
the No.s should to fit into this description...

since ai=0 or 1--> I used python to find (a0,a1,a2...)=bin(50)[:1;-1]

(coz the coeficients are either 1 or 0, combination of lower powers of 3 can't overtake higher powers of 3) hence 50thsmallest combination of powers of 3 is virtually given by bin(50)

==>(a0,a1,a2...)=tuple(bin(50)[:1:-1])=('0', '1', '0', '0', '1', '1')

==>50th smallest N=0* 3^0+1* 3^1+0* 3^2+0* 3^3+1* 3^4+1* 3^5= 327

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...