Updates from the Repl.it team about the product

← Back to all posts
[UPDATE] Weekly Challenge #19
h
TheDrone7 (1649)

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 : @HarperframeInc

RANK 2 : @Lord_Poseidon

RANK 3 : @fuzzyastrocat and @Coder100

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.

Comments
hotnewtop
HarperframeInc (439)

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 34 proven fibonacci primes. Not 50.

So are you looking for a working program that theoretically could do it? Or you want an actual prototype?

xxpertHacker (782)

@HarperframeInc Parallelism, concurrency, efficient algorithms, umm... and some more stuff.

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

xxpertHacker (782)

@HarperframeInc Update: just ran my code, seemed to run pretty fast, but then overflowed the stack after the 11th number. :)

DynamicSquid (4567)

@HarperframeInc have you tried quantum computing? heard those were pretty fast

adl212 (158)

@HarperframeInc Yeah, I have no idea how this is possible.

xxpertHacker (782)

@DynamicSquid Quantum computing is great for only certain types of code, here it would ineffective.

HarperframeInc (439)

@xxpertHacker That's nice, but primes are one of a kind. It's like finding a needle in a hay stack except your 1 needle is in 100K hay stacks

fuzzyastrocat (1504)

@HarperframeInc Lol, my Haskell program "can" do it but it gets hung up on the 8th number, even with laziness and fairly efficient algorithms... I'm really stumped here

HarperframeInc (439)

@fuzzyastrocat Same with my program. I haven't gotten any crashed programs so I'm suggesting that it can do it, it's just not as efficent and needs a better processor.

fuzzyastrocat (1504)

@HarperframeInc Yay now I can get to 11, still gets stuck there tho... I guess I've reached @xxpertHacker's program's performance now

xxpertHacker (782)

@fuzzyastrocat Ha, I honestly wanna check your Repls to see if we did the same thing.

xxpertHacker (782)

@HarperframeInc You say it as if you need to "find" primes, as if it's just by chance. My program makes it look like light-work: https://repl.it/@xxpertHacker/weekly-19#main.rs

xxpertHacker (782)

@fuzzyastrocat Ahh, I see. I was thinking about ditching my current setup, then creating 2 arrays of values, then finding their intersections, it would be efficient, but mutative and impure. Watch me ditch my Rust and use a simple JavaScript array lol.

fuzzyastrocat (1504)

@xxpertHacker Yeah I tried doing lazy intersection with the cartesian product, but it yielded bad performance. I changed it to filter isPrime fibs and it greatly increased performance, so trying to rework my matrix fib solution to be more efficient rn.

HarperframeInc (439)

@xxpertHacker Fibbonacci Primes are much bigger than that my friend- your program is puny at finding it

xxpertHacker (782)

@fuzzyastrocat This challenge is kinda funny, the other ones took me a bit of thinking about just how to achieve the result, now I've already got a few ideas, and need to see how to make it happen computationally.

fuzzyastrocat (1504)

@xxpertHacker Heh yeah, this one's easy in theory but hard in practice

xxpertHacker (782)

@HarperframeInc Oh yeah, I messed up my algorithm badly. Debugging it rn.

FlaminHotValdez (364)

@HarperframeInc Exactly. The largest known prime fibonacci, the 34th has 21925 digits, which has to be stored in a string. And I'm 99.9% sure there's no way of determining whether a number is prime when it is in string form.

TheDrone7 (1649)

@HarperframeInc theoretical lol. It's obvious I don't want beginners to do something like that. But aim for the highest number of terms you can calculate. I've decided to reduce the number of required terms since I realised even with most optimisations it would require the hacker plan to actually be able to do it.

fuzzyastrocat (1504)

@HarperframeInc @xxpertHacker Wait, I just realized... there are 34 (i think) known prime fibonacci numbers. This challenge only needs up to 20. So... copy-and-paste into an array? :D

xxpertHacker (782)

@fuzzyastrocat I thought about just that the first day, but Drone will give a low score for that.

fuzzyastrocat (1504)

@TheDrone7 @xxpertHacker Yeah, I figured a low score would be given (which is why I'm not actually doing that)... though it doesn't say you have to calculate, just generate, but yeah it's a very hacky method of doing it.

The real calculating method is more fun anyways :D

poetaetoes (293)

IS THERE A WEEKLY #20? I DONT SEE IT IF THERE IS ONE

adl212 (158)

@poetaetoes Yeah, I saw that my weekly 19 was scored but he hasn't released the scores either.

AmazingMech2418 (1016)

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

AmazingMech2418 (1016)

@CodeLongAndPros What? I just used 16-byte integers. Fortran generally produces faster binaries than C/C++ and I think even Rust.

CodeLongAndPros (1574)

@AmazingMech2418 Ratfor allows if-then and while loops

fuzzyastrocat (1504)

@AmazingMech2418 OOF why didn't I think of this, lol FORTRAN is like the data science programming language

adl212 (158)

Any idea when this will be scored?

TheDrone7 (1649)

@adl212 I have an exam coming up on 30th so I'll score these after that.

SwaroopBappanad (243)

Jeez, is this a google interview?

xxpertHacker (782)

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.

RohilPatel (1518)

i just lost hacker plan lolol

SpicedSpices (296)

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

TheDrone7 (1649)

@SpicedSpices as said above, the actual program needs to be capable of up to 10th term practically. The rest should be possible "theoretically".

SpicedSpices (296)

@TheDrone7 hmm so "theoretically" means that we don't have to worry about integer limits?

TheDrone7 (1649)

@SpicedSpices well yes. I only need a working algorithm that could calculate them if there were no limits.

SpicedSpices (296)

@TheDrone7 oh ok thank you for clarifying

JackFly26 (94)

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

nicholasptheepi (0)

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)

TheDrone7 (1649)

@nicholasptheepi practically it should be capable of finding up to the 20th terms although since it can be difficult for people without repl.it hacker plan, testing will only be performed till the 10th term. You can make it capable of finding up to the 50th term theoretically however.

FlaminHotValdez (364)

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.

adl212 (158)

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?

xxpertHacker (782)

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.

TheDrone7 (1649)

@xxpertHacker 1 is neither prime nor composite. So the first term is 2.

TheDrone7 (1649)

@xxpertHacker and as for sample input and outputs, there's 4 of them given in the challenge with explanation on how to achieve them.

xxpertHacker (782)

@TheDrone7 Yeah, I should've deleted this comment, since I'd already found that there happens to be a whole Wikipedia page on this. Surprisingly, the idea is pretty simple, but the implementation is incredibly difficult. My code is mostly just trying to prevent stack overflows or something of the sort to make this computationally possible.

EpicGamer007 (1506)

I give up at weekly challenges. :(

dabs364 (276)

50 or infinite or ask

firefish (937)

Would it be OK to have a list of prime numbers (calculated on the spot) and checking if a fib number is in it?

HarperframeInc (439)

@firefish You'll probably get deducted pts for that

firefish (937)

@HarperframeInc Thought of another plan then

TheDrone7 (1649)

@firefish that should be fine. If calculated on the spot.

firefish (937)

@TheDrone7 Ok, that'll make it a tad slow, but so be it...

HarperframeInc (439)

https://weeklywidget.harperframeinc.repl.co
@TheDrone7 I made a dynamic image displaying the leaderboard ^^^

wh0 (5)

hey can you add my entry for last week's too? https://repl.it/talk/share/WEEKLY-18/53886

TheDrone7 (1649)

@wh0 wait, does the website not show your score? Lemme fix that.

wh0 (5)

confirmed, thanks

CoolJames1610 (665)

Btw typo in post

WEEKLY 18 Results

Here are the results for the weekly challenge #17.

Should be weekly challenge #18 xD

CoolJames1610 (665)

Wow 8 points thanks!!!

fuzzyastrocat (1504)

Ayyy, I got 3rd rank! Yay!

Nice job to everyone else, this was a fun one. Next one looks fun too!

dabs364 (276)

darn it i was about to finish