{"id":12504,"date":"2021-09-30T16:30:46","date_gmt":"2021-09-30T11:00:46","guid":{"rendered":"https:\/\/python-programs.com\/?p=12504"},"modified":"2021-11-22T18:33:34","modified_gmt":"2021-11-22T13:03:34","slug":"python-program-to-count-pair-in-an-array-or-list-whose-product-is-divisible-by-k","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-count-pair-in-an-array-or-list-whose-product-is-divisible-by-k\/","title":{"rendered":"Python Program to Count Pair in an Array or List whose Product is Divisible by K"},"content":{"rendered":"

Given a list, the task is to count the number of pairs in the given list whose product is divisible by k in Python.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [1, 15, 19, 2, 9, 6, 10, 12]\r\nGiven k=3<\/pre>\n

Output:<\/strong><\/p>\n

The total number of pairs are =  9<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = 1 9 21 7 34 29 91 3 8 5\r\nGiven k=5<\/pre>\n

Output:<\/strong><\/p>\n

The total number of pairs are = 11<\/pre>\n

Python Program to Count Pair in an Array or List whose Product is Divisible by K<\/h2>\n

Below are the ways to count the number of pairs in the given list whose product is divisible by k in Python.<\/p>\n