# Binary Search

<figure><img src="https://1100854798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F94YmDHMJbD21F4uOcvHm%2Fuploads%2FQ3QXtvDwscY0o9sl1z8v%2Fimage.png?alt=media&#x26;token=d18cd1fa-1741-442a-89a7-8a73aecea9b9" alt=""><figcaption></figcaption></figure>

As mentioned in the description, there is 1000 possibilities but only 10 to guess the correct number.

First we will connect to SSH:

```bash
ssh -p 57159 ctf-player@atlas.picoctf.net
	f3b61b38
```

<figure><img src="https://1100854798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F94YmDHMJbD21F4uOcvHm%2Fuploads%2FBQEmiZEI7xMbytSMpo12%2Fimage.png?alt=media&#x26;token=eb1d2bcd-9885-4b14-88a8-03b6c9f923e7" alt=""><figcaption></figcaption></figure>

We will enter the half of the number he is thinking about which is 500, then the game will tell us if it is higher or lower.

<figure><img src="https://1100854798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F94YmDHMJbD21F4uOcvHm%2Fuploads%2FEUakxTvBqghmGjujOKaP%2Fimage.png?alt=media&#x26;token=8dc38d49-69a7-4cfc-828f-73bc658715e5" alt=""><figcaption></figcaption></figure>

After sending 500, it says lower so in the calculator:

We will go for half of 500 which is 250, it says higher, so it is between 500 and 250 which is 375 using the calculator, it says lower, so it is between 250 and 375 as well with the calculator we will get 312 and so on, until we get the correct number.
