Irrational Fun: Find Yourself at Berlin Buzzwords

We were counting down the days until Berlin Buzzwords on May 25, when we realised that it would be great if you came too! With that in mind, we’ve created a contest. One lucky winner will receive a free ticket to Berlin Buzzwords, including travel expenses and accommodation. Here are the details about how to apply.


The ratio of a circle’s circumference to its diameter, represented by the Greek letter π, is an irrational number—it never terminates or repeats. Your goal is to find the SoundCloud logo in π.

We have provided a 14 pixel by 6 pixel, greyscale reference image:

Here is the same image at 60X magnification:

mag

Each of the 10 shades of grey in this image can be mapped to a number:

Color RGB Hex Number
  ffffff 0
  f0f0f0 1
  ebebeb 2
  d0d0d0 3
  c1c1c1 4
  a8a8a8 5
  878787 6
  535353 7
  333333 8
  000000 9

Applying this mapping to the reference image produces the following 84-digit bitmap:

0 0 0 0 0 3 3 9 9 9 6 0 0 0
0 0 0 3 4 9 5 9 9 9 9 4 0 0
0 1 2 7 5 9 5 9 9 9 9 7 1 0
3 9 5 9 5 9 5 9 9 9 9 9 9 3
6 9 5 9 5 9 5 9 9 9 9 9 9 6
1 8 5 9 5 9 5 9 9 9 9 9 8 1

Your challenge is to write an algorithm that finds the 10 sequences that most closely approximate the reference image. Each result should include the sequence and its position (after the decimal point) in π.

Here is an example result set:

Rank Image Sequence Offset
1 082201638940102393659252475011295776958920 282336494898427768768699465405437965994582 297,640,119
2 310015049916890341096198545241549627773525 291969856827158758552799587406476458977970 792,987,187
3 212021479960265330123798820231693768599316 147634474729776147987653958935291919768971 972,165,010
4 000053743536020032496985553181128909983810 344939134894807349584729687746183109884672 981,165,566
5 142204297650171312983445842322141909755200 787408739757838589593329762648444919386594 789,652,974
6 300011495970664010077917573663456957498854 662995598898697947677549686339433357728071 197,342,990
7 313560984264300011495970664010077917573663 456957498854662995598898697947677549686339 197,342,978
8 870402479996214234001557832923050859979903 649788689695954439755933903629798966788984 75,975,342
9 208503759370245135490877462200175839969750 453766432680245845143285985661373828688970 343,577,393
10 300544295771128716836756973814286978997516 282647269986574856578306678421894769876141 950,462,734

Entries will be judged against the follow criteria:

  • Code quality
  • Runtime performance
  • Visual closeness to the reference image (subjective)

You should run your algorithm against the following data set (approximately 1 GB), which contains the first 1,000,000,000 (billion) digits of π.

Please send your submission, including a link to the source-code repository, to e@soundcloud.com on or before May 5, 2014 23:59 UTC. Your repository should contain a README that includes instructions about how to set up and run your code. Entries are subject to the terms and conditions.


UPDATE

Congratulations to Tomasz Pewiński, who submitted the winning entry.

We’d also like to acknowledge entries by Dan Oved and Martin Kühl, which were also excellent. Thanks to everyone else who participated in the contest. We hope it was fun!