Calculates fibonacci number under a specified maximum