Tap here to switch tabs
Problem
Submissions

Problem: Number of Different Subsequences GCDs

Number of Different Subsequences GCDs asks you to count the distinct greatest common divisors produced by all nonempty subsequences of an array of positive integers.

Statement

You are given an array nums consisting of positive integers.

The greatest common divisor (GCD) of a sequence of integers is the largest positive integer that divides every integer in the sequence.

Return the total number of distinct greatest common divisors among all nonempty subsequences of nums.

Note: A subsequence of an array is a sequence that can be derived from the array by deleting zero or more elements without changing the relative order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤2×105\leq 2 \times 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Different Subsequences GCDs

Number of Different Subsequences GCDs asks you to count the distinct greatest common divisors produced by all nonempty subsequences of an array of positive integers.

Statement

You are given an array nums consisting of positive integers.

The greatest common divisor (GCD) of a sequence of integers is the largest positive integer that divides every integer in the sequence.

Return the total number of distinct greatest common divisors among all nonempty subsequences of nums.

Note: A subsequence of an array is a sequence that can be derived from the array by deleting zero or more elements without changing the relative order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤2×105\leq 2 \times 10^5