# [UPDATE] Weekly Challenge #19

Hey there replers! 2 weeks ago, we started the 5th batch of repl.it weekly challenges!

So below are the results for the last weekly challenge aka Weekly Challenge #18.

### WEEKLY 18 Results

Here are the results for the weekly challenge #18.

**RANK 1 :**

**RANK 2 :** @Lord_Poseidon

**RANK 3 :**

In case you did not make into the top 3, you can check out your score at the weekly results website - https://weekly.thedrone7.repl.co

But before that, here's this week's weekly challenge for you all!

### PRIME FIBONACCI!

Basically, fibonacci series but instead of using whole numbers, you use prime numbers. The first time will be 2, second term will be 3, and third time will be 2 + 3 = 5. But here comes the tricky part, the term should always be a prime number. So, 5 + 3 = 8 will be invalid, moving forward, 5 + 8 = 13 so 4th term will be 13 (which is prime again). Your program should be able to generate up to 5

20 such terms.

Also, for testing, only the first 10 terms will be checked but it should (at least theoretically) be possible of finding up to 20 terms.

**SUBMISSION**

For submitting your repls, post them on the repl talk share board and ensure that they contain `#WEEKLY`

in their name.

NOTE :You cannot have multiple weekly challenge submissions but if you want to share multiple ways of achieving the goal, you can make regular posts that don't contain`#WEEKLY`

in their name, even`WEEKLY`

is fine.

And that's it for today, code away and have fun replers!

**UPDATE**

Since calculating up to 50 terms seems to be not possible without the hacker plan (lack of resources). The requirement has been reduced to 20 terms instead.

test

Fortran is awesome! I can get the first 12 in like 20 seconds. LOL!

*the*data science programming language

Jeez, is this a google interview?

no constraints?

Since calculating up to 50 terms seems to be not possible without the hacker plan...

Actually, I have the hacker plan, but I still can't figure out how to get my code to pull it off. It's all about code design.

Ohh, I think I see where I went wrong. I'll probably submit later today.

i just lost hacker plan lolol

The 14th Fibonacci prime, 19134702400093278081449423917, is the last one before it overflows past a 128 bit integer. The only way to continue going forth is to add an external library, or to add strings together.

Even the Sieve of Atkin written in Rust, one of the fastest known prime tests, takes almost a minute to tell if 19134702400093278081449423917 is prime. Not even going to think about the other 6.

What's being asking for here is a mathematical miracle, or for us to write code with a runtime of days.

ill keep working on it though, it seems like a fun challenge

My repl from last week didn't seem to get scored.

Are we just meant to write a program which can generate up to 50 of these terms, or to actually find them. It took my program 68 seconds just to find the 11th... (also yes i know 2 isnt in the list)

This is impossible. There are only 34 Fibonacci numbers that are proven to be prime. It's not even certain that there ARE 50 primes. Even if there are, the 34th Fibonacci prime has 21925 digits and is the 104911th Fibonacci number. The theoretical 50th Fibonacci prime has 678033 digits and is the 3244369th Fibonacci number. Even if you use strings to store the numbers, you'd need a heck of a lot of either memory or time to compute whether it is prime, depending on the method you use.

So, basically, the challenge is to return n amount of terms of the "prime" fibonacci sequence right? Also, we can use loops and recursions this time right?

If I might ask, could a slightly better description of the expected input and output be given? I think I already see how it's supposed to be, but just for insurance.

Also, isn't "1" a prime number, thus the first term would be "1," not 2?

Update: my logic was implemented incorrectly, 1 isn't prime, I forgot. And I searched it up to get more details already.

I give up at weekly challenges. :(

pog

Wait a minute- How is this possible?

Such a formula would require intense computing power which we don't have- and the last site I've been on was only able to calculate the 21 first primes of Fibonacci.

Edit: Wikipedia says there are only has 34provenfibonacci primes. Not 50.So are you looking for a working program that theoretically could do it? Or you want an

actualprototype?I've got both, an efficient Fibonacci function and an efficient prime finder, let's see how this works.

`filter isPrime fibs`

and it greatly increased performance, so trying to rework my matrix fib solution to be more efficient rn.calculate, justgenerate, but yeah it's a very hacky method of doing it.The real calculating method is more fun anyways :D