Write in Prolog programming language (NOT in 'Python' or in any
other language. Please provide answer in Prolog programming
language):
i. Determine whether there are two occurrences of 1 in a
list.
ii. Determine the number of elements in a list divisible by
3.
iii. Find the largest square number in a list.
iv. Find the greatest common divisor of the list elements
(2,4,16,8) > 2
v. Find a subsequence of a list the sum of which are square
numbers.
vi. Given term like this f(g(a,b), f(a,g(a,b) ) a,b: arguments ,
Exchange every a in the term to b.
A possible definition of a binary tree is:
btree(N):- integer(N); N=nil.
btree((N,L,R)):- integer(N), btree(L), btree( R).
i. Find the rightmost branch of a tree.
ii. Find the levels of a tree that contains cube numbers.
Write in Prolog programming language (NOT in 'Python' or in any other language. Please provide answer in Prolog programm
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am