Given an array arr[] of positive integers of size N, the task is to count number of triplets in the array such that a[i] divides a[j] and a[j] divides a[k] and i < j < k.

Examples:

Input: arr[] = {1, 2, 3, 4, 5, 6}
Output: 3
Explanation:
The triplets are: (1, 2, 4), (1, 2, 6), (1, 3, 6).

#c #c# #c++ #programming-c

Count of triplets (a, b, c) in the Array such that a divides b and b divides c
3.10 GEEK