Skip to content

Practice Find the Number of Subsequences With Equal GCD

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3336
LeetCode Problem

Find the Number of Subsequences With Equal GCD

Problem Statement

Given nums, count ordered pairs of nonempty subsequences that use disjoint indices and have equal greatest common divisors. Return the count modulo 10^9 + 7.

Source: Find the Number of Subsequences With Equal GCD on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,4]
Output
10

# Example 2

Input
nums = [10,20,30]
Output
2

# Example 3

Input
nums = [1,1,1,1]
Output
50

Constraints

1 <= nums.length <= 200
1 <= nums[i] <= 200

Related LeetCode Problems

Practice more problems similar to Find the Number of Subsequences With Equal GCD.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.