Python | Count the array elements with factors less than or equal to the factors of given x
Given an array, the task is to count the elements of array whose factors are less than the given number x.
Input: arr = [2, 12, 4, 6], x = 6
factors of x = 6 is [1, 2, 3]
factors of arr = 2 is 
factors of arr = 12 is [1, 2, 3, 4]
factors of arr = 4 is [1, 2]
factors of arr = 6 is [1, 2, 3]
so only arr and arr are the answer.
Find out factors of all the elements and that of given xand after that compare all of them if factors of elements are less than that of factors of x, then increment the count.
Below is the implementation of above problem –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course