Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Subsequences With Equal GCD

med
30 min
Try to solve the Find the Number of Subsequences With Equal GCD problem.

Statement

Given an integer array nums.

Find the number of pairs of disjoint non empty subsequences (seq1, seq2) of nums such that the greatest common divisor of the elements in seq1 equals the greatest common divisor of the elements in seq2.

Since the answer may be very large, return it modulo 109+710^9 + 7.

Note:

  • A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

  • Two subsequences are disjoint if their chosen indices in nums do not overlap.

  • The greatest common divisor of a sequence of integers is the largest positive integer that divides all elements in the sequence.

Constraints:

  • 1≤1 \leq nums.length ≤200\leq 200

  • 1≤1 \leq nums[i] ≤200\leq 200

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of Subsequences With Equal GCD

med
30 min
Try to solve the Find the Number of Subsequences With Equal GCD problem.

Statement

Given an integer array nums.

Find the number of pairs of disjoint non empty subsequences (seq1, seq2) of nums such that the greatest common divisor of the elements in seq1 equals the greatest common divisor of the elements in seq2.

Since the answer may be very large, return it modulo 109+710^9 + 7.

Note:

  • A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

  • Two subsequences are disjoint if their chosen indices in nums do not overlap.

  • The greatest common divisor of a sequence of integers is the largest positive integer that divides all elements in the sequence.

Constraints:

  • 1≤1 \leq nums.length ≤200\leq 200

  • 1≤1 \leq nums[i] ≤200\leq 200