2016-01-26 PHP Coding Challenge

PHP Coding Challenge
1. Count the number of Fibonacci numbers in given range. First few Fibonacci
numbers
are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 141, ..
Range is 10 to 100
http://www.geeksforgeeks.org/count-fibonacci-numbers-given-range-log-time/
2. Count factorial numbers in a given range
A number F is a factorial number if there exists some integer I >= 0 such that F = I!
(that is, F is factorial of I). Examples of factorial numbers are 1, 2, 6, 24, 120, ….
Write a program that takes as input two long integers ‘low’ and ‘high’ where
0 < low < high and finds count of factorial numbers in the closed interval [low, high].
Input: low = 2, high = 720
http://www.geeksforgeeks.org/count-factorial-numbers-in-a-given-range/
3. Find smallest values of x and y such that ax – by = 0
Given two values ‘a’ and ‘b’ that represent coefficients in “ax – by = 0″, find the
smallest values of x and y that satisfy the equation. It may also be assumed that
x > 0, y > 0, a > 0 and b > 0.
Input: a = 25, b = 35
http://www.geeksforgeeks.org/find-smallest-values-of-x-and-y-such-that-ax-by-0/
4. Find the smallest twins in given range
Given a range [low..high], print the smallest twin numbers in given range (low and high
inclusive). Two numbers are twins if they are primes and their difference is 2.
Example:
Input: low = 10, high = 100
Output: Smallest twins in given range: (11, 13)
Both 11 and 13 are prime numbers and difference
between them is two, therefore twins. And these
are the smallest twins in [10..100]
Input: low = 50, high = 100
http://www.geeksforgeeks.org/find-the-smallest-twin-numbers-in-given-range/
5. Find four elements a, b, c and d in an array such that a+b = c+d
Given an array of distinct integers, find if there are two pairs (a, b) and (c, d) such that
a+b = c+d, and a, b, c and d are distinct elements. If there are multiple answers, then
print any of them.
Input: {3, 4, 7, 1, 2, 9, 8}
http://www.geeksforgeeks.org/find-four-elements-a-b-c-and-d-in-an-array-suchthat-ab-cd/