It's challenge time! This week's task is a fun one.
For a specified integer x , find the number of positive integers with binary representations, between 2 and 8 digits, that occur in the binary representation of x.
e.g. 1110 = 10112
The combinations that occur are as follows: 1011, 101, 10, 11. So for the number 15, you should find 4 integers.
2210 = 101102
The combinations that occur are as follows: 10110,1011,101,10,11,110. So for the number 22, you should find 6 integers.
56010 = 10001100002
The combinations that occur are as follows: 10001100, 1000110, 100011, 10001, 1000, 100, 10, 11, 110000, 11000, 1100, 10000, 110. So for the number 560, you should find 13 integers.
Remember, 2 to 8 digits. So 1 and 0 don't count, and neither do integers of more than 8 bits. x can take a value up to 65536.
Entries posted here: http://0x10command.c...allenge/week-5/
Challenge Week 5: June 11 - June 18
Started By Fang, Jun 11 2012 10:37 PM
5 replies to this topic
#1
Posted 11 June 2012 - 10:37 PM
#2
Posted 12 June 2012 - 09:41 PM
Fang, on 11 June 2012 - 10:37 PM, said:
For a specified integer x , find the number of positive integers with binary representations, between 2 and 8 digits, that occur in the binary representation of x.
56010 = 10001100002
The combinations that occur are as follows: 1000110000, 100011000, 10001100, 1000110, 100011, 10001, 1000, 100, 10, 11, 110000, 11000, 1100, 110. So for the number 560, you should find 14 integers.
Remember, 2 to 8 digits. So 1 and 0 don't count, and neither do integers of more than 8 bits. x can take a value up to 65536.
56010 = 10001100002
The combinations that occur are as follows: 1000110000, 100011000, 10001100, 1000110, 100011, 10001, 1000, 100, 10, 11, 110000, 11000, 1100, 110. So for the number 560, you should find 14 integers.
Remember, 2 to 8 digits. So 1 and 0 don't count, and neither do integers of more than 8 bits. x can take a value up to 65536.
Did you mean to include 1000110000 and 100011000? They contain more than 8 binary digits.
#4
Posted 14 June 2012 - 05:02 AM
Just a couple more things. 10112 == 1110 not 1510. For 56010, you missed the 10000 pattern so there are 13 values.
Also, I was playing around and submitted my answer as private. Now I can't find a way to make it public again, lol.
Also, I was playing around and submitted my answer as private. Now I can't find a way to make it public again, lol.
#5
Posted 14 June 2012 - 07:50 AM
Well that's embarrassing. I've fixed them again, thanks!
If on the code page, you click "Edit" it will take you to the edit page. Here click "Save Edit" and in the dropdown panel uncheck the box which says Draft/Private?
If on the code page, you click "Edit" it will take you to the edit page. Here click "Save Edit" and in the dropdown panel uncheck the box which says Draft/Private?
#6
Posted 14 June 2012 - 04:30 PM
Ahh thanks, I was thinking that it would be on the Settings page so I never clicked save to once again see the submit settings page.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











