Question: Using prolog please Question 5 (4 marks) The Fibonacci sequence is a famous numerical sequence with a recursive definition. The Fibonacci sequence is defined as

Using prolog please

Using prolog please Question 5 (4 marks) The Fibonacci sequence is a

Question 5 (4 marks) The Fibonacci sequence is a famous numerical sequence with a recursive definition. The Fibonacci sequence is defined as follows: 1. The first number is 1. 2. The second number is 1 . 3. Every other number, after the first two, is the sum of the two numbers that come before it. So the first few numbers in the Fibonacci sequence are: 1,1,2,3,5,8,13,21,34 Write a predicate fibonacci (N,X) such that, if N is a positive integer, X is the Nth number in the Fibonacci sequence. You will need to use recursion to define this predicate. For example, if N is 7 , then X should be 13 (the 6th number in the sequence)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!