- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions

# Check if LCM of array elements is divisible by a prime number or not in Python

Suppose we have an array called nums and another value k, we have to check whether LCM of nums is divisible by k or not.

So, if the input is like nums = [12, 15, 10, 75] k = 10, then the output will be True as the LCM of the array elements is 300 so this is divisible by 10.

To solve this, we will follow these steps −

- for i in range 0 to size of nums - 1, do
- if nums[i] is divisible by k, then
- return True

- if nums[i] is divisible by k, then
- return False

## Example

Let us see the following implementation to get better understanding −

def solve(nums, k) : for i in range(0, len(nums)) : if nums[i] % k == 0: return True nums = [12, 15, 10, 75] k = 10 print(solve(nums, k))

## Input

[12, 15, 10, 75], 10

## Output

True

- Related Articles
- Check if any large number is divisible by 17 or not in Python
- Check if any large number is divisible by 19 or not in Python
- Check if a number is Primorial Prime or not in Python
- Check if a number is divisible by 23 or not in C++
- Check if a number is divisible by 41 or not in C++
- Python program to check if a number is Prime or not
- Check whether the sum of prime elements of the array is prime or not in Python
- Check if a large number is divisible by 11 or not in C++
- Check if a large number is divisible by 25 or not in C++
- Check if a large number is divisible by 3 or not in C++
- Check if a large number is divisible by 5 or not in C++
- Check if a large number is divisible by 75 or not in C++
- Check if a large number is divisible by 8 or not in C++
- Check if a large number is divisible by 9 or not in C++
- Check if a large number is divisible by 13 or not in C++

Advertisements