0

Write a function with the prototype unsigned long findFibonacciPrimes(unsigned long lowerBound, unsigned long upperBound, unsigned long result[]) which populates the array result with all of the prime numbers that are also Fibonacci numbers between lowerBound (inclusive) and upperBound (inclusive), and then returns the number of Fibonacci primes that were found.
A prime number is any number that has only two integer divisors, itself and 1. For example, the number 13 is prime, because its only integer divisors are 1 and 13 (1 x 13 = 13). However, the number 9 is not prime, because it has three integer divisors: 1, 3 and 9 (1 x 9 = 9 and 3 x 3 = 9).
A Fibonacci number is one that follows the following rules:
 The first Fibonacci number is 0
 The second Fibonacci number is 1
 Every Fibonacci number above this can be calculated as the sum of the previous two Fibonacci numbers
The first ten Fibonacci numbers are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34...
The array result is guaranteed to have enough space to store all the numbers found. Your program will crash if it attempts to write past the end of the array, and no marks will be awarded for any tests this occurs in. You are also guaranteed that 1 < lowerBound < upperBound < 3,000,000,000.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by daviddoria
0

Please post a significant attempt and we can try to help if you get stuck. If you don't want to do your assignment, why should we??

Also, please use a much more descriptive thread title.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.