Instantly share code, notes, and snippets.

@Atlas7 / Secret
Last active Jul 14, 2017

What would you like to do?

I've recently bumped into this pretty interesting mini Intel Developer Zone challenge on Facebook:

How can you use eight 8s to get the number 1000?


So I decided to give it a go - and (I think) I successfully solved it. Took me 5 minutes experimenting.

The first thing I see when I see the number 8 is 2**3 (two to the power of 3). This implies it could be something to do with binary system.

Then I see the number 1000 - could this be binary 1000 (i.e. representing decimal number 8)?

I ended up writing a one line Python 3.6 code:

print(bin(8 >> (8//8//8//8//8//8//8)))

Evaluating the floor division //, the code effectively is the same as:

print(bin(8 >> 0))

i.e. right shift the binary 1000 by 0 bit to 1000 (i.e. no change!). And of course this prints out:


Lesson learnt of the day!

Answers from other participants

I've also obtained the following really cool answers from others on Facebook:

Cool answer 1:

888 + 88 + 8 + 8 + 8 = 1000

Cool answer 2:

8888 / 8.888 = 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment