Problem 44481. How many Fibonacci numbers?
Find the number of unique Fibonacci numbers (don't count repeats) in a vector of positive integers.
Example:
x = [1 2 3 4 5 6 7 8 8] y = 5
Solution Stats
Problem Comments
-
8 Comments
Hi Bob, in the last testsuite problem the last element in your x vector cannot be properly represented using double precision (t will be indistinguishable from similar numbers differing by anything within the last 88 digits). Please either switch to using other suitable representations (e.g. java big integers) or modify the testsuite to keep the values there a bit smaller (double precision can reasonably work with integers below ~1e15 and int64 could go up to ~1e20)
I went ahead and changed the test suite so the last number can be safely represented as an integer in double precision floating point.
having issue with that large number e^15 even using format long g...precision is reduced.. method of perfect square identfying doesnt work here
Solution Comments
Show commentsProblem Recent Solvers803
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15638 Solvers
-
1970 Solvers
-
Flag largest magnitude swings as they occur
681 Solvers
-
11303 Solvers
-
Calculate the average value of the elements in the array
1350 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!