# What on Earth Was the JetBrains Quest?

We have a lot of developers at JetBrains, and many of us like games – challenging games. We came up with the idea of creating a treasure hunt in which the solution to each puzzle was the hint for the next one. We’d hide all the puzzles as easter eggs inside JetBrains sources. After a long period of brainstorming, JetBrains Quest was born.

JetBrains Quest was a series of puzzles spread throughout different JetBrains pages and products. The game consisted of 3 Quests, with 4-6 puzzles to solve per quest. The first quest was relatively easy to give people a chance to figure out what to expect with the difficulty increasing as you moved along. The Quest began on March 9 with a post on our social media networks (
Twitter, Facebook and Linkedin) and it ended on March 15 at 12:00 CET. At this point all of the puzzles were removed.

The response from the community was amazing!

Some of them struggled.

Based on the comments, it looks like the most difficult puzzle to solve was the Fibonacci exercise. This puzzle was hidden inside a Tip of the Day in a specific version of IntelliJ IDEA Community Edition.

You have discovered our JetBrains Quest! If you don’t know what this is, you should start from the beginning.
This is it. The last puzzle. You are just one step away from glory!
Now you just need the Key to unlock the Quest page.
The Key is the first and last 4 digits of the 50 * 10^6 position of the Fibonacci sequence (F(50 Million)).
As you may know by now, not all that glitters is gold, and to solve this puzzle you should not go straight for the obvious answer. May you make a glorious choice.
Remember that you have until the 15th of March 12:00 CEST.

This was the last puzzle of the entire Quest. If you attempt to solve it using a linear approach, it will take hours or even days to get the answer. There were two main approaches to tackling this puzzle. The easy one was to use Wolfram|Alpha to get the first and last four digits.

The second way is more difficult, but it comes with a bonus: a bigger feeling of accomplishment! There are algorithms that make the computation for the Fibonacci sequence faster. We were expecting you to implement one of these options. Here’s an example:

```import math
def last_fib_digits(fib_number, last_digits):
prev, cur = 0, 1
q = 10 ** last_digits
while fib_number > 0:
prev, cur = cur, prev + cur
fib_number -= 1
cur %= q
return prev
def first_fib_digits(fib_number):
phi = (math.pow(5.0, 0.5) + 1) / 2
logF = fib_number * math.log10(phi) - 0.5 * math.log10(5.0)
return math.pow(10.0, logF - int(logF))
print(last_fib_digits(50000000, 4))
print(first_fib_digits(50000000))
```

First 4 digits: 4602
Last 4 digits: 3125

For those of you who didn’t manage to finish the Quest, you can see all the puzzles and their solutions here.

We would like to thank everyone who took part in our JetBrains Quest and joined in the fun. Leave a comment below and let us know which puzzle was your favorite.

Thanks for joining in! May you always have an adventure in your life!
– The JetBrains Quest Team

Comments below can no longer be edited.

1. #### Haim Lvov says:

March 28, 2020

Yay! My comment to the quests was highlighted here! 😀

2. #### Flo says:

April 3, 2020

Fibonacci took me the longest, because I interpreted “first and last 4 digits” to the single first digit and the last 4 (so 5 in total).

3. #### thosesays:

May 1, 2020

For those of you who didn’t manage to finish the Quest, you can see all the puzzles and their solutions