Cicada 3303

Hint: The code number is a 32 bit integer.


The answer is 226721964.

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 picture appears mirrored on the horizontal. However, careful examination of the image reveals that the top and bottom of the image are minimally different.

To process the image in python we use the library numpy and the class Image from the PIL library. The code line

pic = np.array(Image.open('Cicada3303.png').convert('L'))

loads the image, converts it to a grayscale image, and transforms it into a numpy array pic . The two-dimensional array pic has 320 lines and 320 columns and stores the grayscale value of each pixel. There is some noise in the picture, so the last bit of the grayscale value fluctuates. This noise is different between top and bottom of the image.

If the picture is really mirror-symmetrical on the horizontal, the expression pic[i][j] == pic[i][-1-j] must be true for all indices i an j within the image. If we make this comparison for all the pixels in this image, we can create a new image in which we color each pixel black and white, depending on whether the result is true or false. The result is the following picture

This image is stored in the array xorPic as a sequence of zeros and ones. We get a kind of barcode that repeats 10 times in each line. Because each line consists of 320 pixels, the barcode encodes a 32-bit integer. At the end we have to convert the binary code into a number. For this we multiply the bit-number xorPic[0][32 - i] by the two-potency 2**i and sum up the whole result. The result is the number code , which equals

226721964

The following python code performs all of the above operations and calculates the code number.

1
2
3
4
5
6
7
import numpy as np
from PIL import Image

pic = np.array(Image.open('Cicada3303.png').convert('L'))
xorPic = np.array([[(pic[i][j] != pic[-i-1][j])*1 for j in range(320)] for i in range(320)])
code = sum([xorPic[0][-1-j]*2**j for j in range(32)])
print(code)

This was really convoluted

Julian Poon - 3 years ago

Log in to reply

The problem was very simple, I could solve it in three lines of code.

The next problem will probably be even "easier" ...

Markus Michelmann - 3 years ago

Log in to reply

Mate did you get selected by the Cicade?

Krishna Karthik - 1 year, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...