Problem 56428. Easy Sequences 79: Trailing Zeros of Fibonorial Numbers at any Base
Solution Stats
Problem Comments
-
1 Comment
Note that in addition to global, persistent, java and BigInteger; for, if, case, and switch are forbidden.
Only needs scalar inputs - test cases do arrayfun()s.
Solution Comments
-
1 Comment
No lookups, no strings. I did kludge a recursion hack against variable scope because I needed sequential iteration.
-
5 Comments
Hi, there is also a solution that does not rely in hardcoded lookup array.
Are you saying there is an easy way to generate the lookup values or that there is a method that doesn't need those values?
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.
Problem Recent Solvers3
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
5051 Solvers
-
3962 Solvers
-
2295 Solvers
-
37 Solvers
-
Highly divisible triangular number (inspired by Project Euler 12)
84 Solvers
More from this Author102
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!