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 Solvers795
Suggested Problems
-
2965 Solvers
-
Get the area codes from a list of phone numbers
1062 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1196 Solvers
-
Pernicious Anniversary Problem
823 Solvers
-
303 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!