Tap here to switch tabs
Problem
Submissions

Problem: Sum of Beautiful Subsequences

Try to solve the Sum of Beautiful Subsequences problem.

Statement

You are given an integer array nums.

A subsequence of nums is called beautiful if it is strictly increasing. The beauty of a non empty strictly increasing subsequence is defined as the greatest common divisor (GCD) of all its elements.

Return the total sum of the beauty across all non empty strictly increasing subsequences of nums.

Constraints:

  • 1≤n==1 \leq n == nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤7imes104\leq 7 imes 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Beautiful Subsequences

Try to solve the Sum of Beautiful Subsequences problem.

Statement

You are given an integer array nums.

A subsequence of nums is called beautiful if it is strictly increasing. The beauty of a non empty strictly increasing subsequence is defined as the greatest common divisor (GCD) of all its elements.

Return the total sum of the beauty across all non empty strictly increasing subsequences of nums.

Constraints:

  • 1≤n==1 \leq n == nums.length ≤104\leq 10^4

  • 1≤1 \leq nums[i] ≤7imes104\leq 7 imes 10^4