Write in Prolog programming language (NOT in 'Python' or in any other language. Please provide answer in Prolog programm

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write in Prolog programming language (NOT in 'Python' or in any other language. Please provide answer in Prolog programm

Post by answerhappygod »

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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply