-
5 Comments
you can make a lookup array if you like. but it is not necessary to hardcode any values. when i made this problem i didn't see that the test requires only a few primes will be used. which makes it even more easier to create an array of prime entry points without precomputing. in fact, there is actually no reason to make a lookup list.
you can learn about prime entry points here: https://r-knott.surrey.ac.uk/Fibonacci/fibCalcX.html
Found on oeis A001177, prime p divides exactly one of a(p-1:p+1). This means that the entry point is a factor of one of those three. Probably sufficient here is that it is never larger than p+1.
Suggested Problems
-
3414 Solvers
-
1821 Solvers
-
Splitting Square - Problem the third
34 Solvers
-
Easy Sequences 56: Counting "Ugly" Numbers
6 Solvers
-
102 Solvers
More from this Author116
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!