+0  
 
0
1094
5
avatar+296 

How many zeroes do we write when we write all the integers from 1 to 243 in base 3?

 

My incorrect work: 1-242 inclusive in base 3 would be 1-22222_3. The possible zeroes will be 216. Then, account for 243, then add another 5 zeros to get 221 as my final answer. Please give a concise solution on how to do this problem. Thank you :D

 Mar 24, 2020
 #1
avatar+2095 
0

Pattern:1,2,10,11,12,20,21,22,100,…

Last number in the sequence: 3^5, or 100,000 in base 3.

 

In this sequence, every third number has a zero, and every 9th number has 2 zeros, and so on.

 

If we add all of these together, we will get: 81+27+9+3+1=121 zeros.

 

Hope this helped!

 Mar 24, 2020
 #2
avatar+499 
+1

:/

 

https://www.quora.com/How-many-zeroes-do-we-write-when-we-write-all-the-integers-from-1-to-243-in-base-3

 

@EpicWater

This is a reference website, has the same (albeit more detailed) solution that CGT outlined for us

jfan17  Mar 24, 2020
edited by jfan17  Mar 24, 2020
edited by jfan17  Mar 24, 2020
 #4
avatar
0

int = (1 - 100000 in base 3]. There are, as you can see at the bottom, 289 zeros.

a = 0; b=0; c=0; d=0; e=0; f=0; g=0; h=0; i=0; k=0 for n in (int): for j in str(n): if j == "0": a +=1 if j == "1": b +=1 if j == "2": c +=1 # Code to count number of digits between ANY two ranges and their total value # if j == "3": d +=1 if j == "4": e +=1 if j == "5": f +=1 if j == "6": g +=1 if j == "7": h +=1 if j == "8": i += 1 if j == "9": k +=1 print([a, b, c, d, e, f, g, h, i, k],"Total number=",(a+b+c+d+e+f+g+h+i+k)) print("Sum Value =", b*1 + c*2 + d*3 +e*4 + f*5 + g*6 + h*7 + i*8 + k*9)

[289, 406, 405]  - These are counts of all 3 digits [0, 1, 2]

Guest Mar 24, 2020
 #3
avatar+296 
+1

thx for the help and support :D

 Mar 24, 2020

4 Online Users