1 Replies - 1458 Views - Last Post: 08 December 2009 - 05:19 PM

#1 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 729
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

fibonacci in prolog

Posted 25 March 2009 - 07:21 PM

Description: an example of the fibonacci series in prolog, the function will return true, if Y is the fibonacci value of X
fib(0, 1).
fib(1, 1).

fib(X, Y):-
	X > 1, X1 is X - 1, X2 is X - 2, fib(X1, Z), fib(X2, W), Y is W + Z.


Is This A Good Question/Topic? 0
  • +

Replies To: fibonacci in prolog

#2 arni0605  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 08-December 09

Re: fibonacci in prolog

Posted 08 December 2009 - 05:19 PM

well done uploader!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1