The Binary Box

Consider an integer n n in base 10, whose binary form can be expressed as a string S S . Let the minimum value of n n be N N , such that the sub-strings of S S include binary numbers from 1 1 to 1000 0 2 10000_2 . What is the sum of digits of N N ?

Details and Assumptions

  • For example, the integer 9 9 , whose binary form can be expressed as a string 1001 1001 includes sub-strings of 0 , 1 , 10 , 1001 0,1,10,1001 , but not 101 101 .


The answer is 28.

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.

1 solution

the no. is -169840 ,sum of its digit is 28

from where did u get the no. -169840???

Ahmed Sayed - 6 years, 9 months ago

In binary, 169840 is 101001011101110000. 101001011101110000. This does not contain the substring 1111.

@Christopher Boo , can you post your intended value of N N ?

Jon Haussmann - 6 years, 8 months ago

Log in to reply

39664, which in binary, 1001101011110000.

Christopher Boo - 6 years, 8 months ago

Log in to reply

So, how did you get that value? I want to know.

Joeie Christian Santana - 6 years, 8 months ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def SB(x):
    li=[]
    k=format(x,'b')
    for i in range(len(k)):
        for j in range(i+1,len(k)+1):
            li.append(int(k[i:j]))
        li=sorted(list(set(li)))    
    if li[1:17]==[1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000]:
        return True
    else:
        return False

According to my program, if a number follows your property, it prints True . It printed True for the smallest value of 33964 33964 , what was the way you used?

Aditya Raut - 6 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...