Find powers of 2 in a list Prolog
问题 I'm trying to create a list in Prolog (SWI Prolog) and check which numbers are powers of 2 and second find how many times a specific number is in the list (in this example I'm trying to find how many times the number 3 is in the list). For a example, if you ask ?- check([0,2,3,-5,-2,1,8,7,4], MULT2, THREE). you should see MULT2=[2,8,4] THREE=1 My first try to find a solution is to search the list with head and doing head mod 2 = 0 to find all numbers which are powers of 2, but something went