Given integers x and n, we are asked to evaluate the following function:
. That is, P equals x raised to the power of the n-th Fibonacci number. We define
as follows:
and
for
.
Example:
.
Please reduce the output, modulo
.
------------------------
HINT: One solution is already shown, however java math is not allowed.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2553 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1311 Solvers
-
Similar Triangles - find the height of the tree
472 Solvers
-
Pernicious Anniversary Problem
839 Solvers
-
Easy Sequences 19: Length of Prime-sided Rectangle with Maximum Area
11 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Test 10 is wrong. I ran your algorithm using java math and obtained:
s=[1021322 1048348 1452207 670027] which is the same figures I obtained using my algorithm. My algorithm passes all the other tests.
Hi David, I have not accounted for Fibonacci of 0 which is 0, which is required in my algorithm. Please try again.
Surprisingly easy once you see a couple of tricks.