Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Ideal Arrays

med
30 min
Try to solve the Count the Number of Ideal Arrays problem.

Statement

You are given two integers n and maxValue.

An array arr of length n is called ideal if:

  • Every element satisfies 1≤1 \leq arr[i] ≤\leq maxValue for all 0≤0 \leq i << n.

  • For every index i such that 1≤1 \leq i << n, arr[i] is divisible by arr[i - 1].

Return the total number of distinct ideal arrays of length n. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 2≤2 \leq n ≤104\leq 10^4

  • 1≤1 \leq maxValue ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Ideal Arrays

med
30 min
Try to solve the Count the Number of Ideal Arrays problem.

Statement

You are given two integers n and maxValue.

An array arr of length n is called ideal if:

  • Every element satisfies 1≤1 \leq arr[i] ≤\leq maxValue for all 0≤0 \leq i << n.

  • For every index i such that 1≤1 \leq i << n, arr[i] is divisible by arr[i - 1].

Return the total number of distinct ideal arrays of length n. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 2≤2 \leq n ≤104\leq 10^4

  • 1≤1 \leq maxValue ≤104\leq 10^4