CF BUDDY
← Problems·

1542C · Strange Function

1600 · math, number theory

Problem: Let f(i)f(i) denote the minimum positive integer xx such that xx is not a divisor of ii.

Compute i=1nf(i)\sum_{i=1}^n f(i) modulo 109+710^9+7. In other words, compute f(1)+f(2)++f(n)f(1)+f(2)+\dots+f(n) modulo 109+710^9+7.

Input Format: The first line contains a single integer tt (1t1041\leq t\leq 10^4), the number of test cases. Then tt cases follow.

The only line of each test case contains a single integer nn (1n10161\leq n\leq 10^{16}).

Output Format: For each test case, output a single integer ansans, where ans=i=1nf(i)ans=\sum_{i=1}^n f(i) modulo 109+710^9+7.

Note: In the fourth test case n=4n=4, so ans=f(1)+f(2)+f(3)+f(4)ans=f(1)+f(2)+f(3)+f(4).

  • 11 is a divisor of 11 but 22 isn't, so 22 is the minimum positive integer that isn't a divisor of 11. Thus, f(1)=2f(1)=2.
  • 11 and 22 are divisors of 22 but 33 isn't, so 33 is the minimum positive integer that isn't a divisor of 22. Thus, f(2)=3f(2)=3.
  • 11 is a divisor of 33 but 22 isn't, so 22 is the minimum positive integer that isn't a divisor of 33. Thus, f(3)=2f(3)=2.
  • 11 and 22 are divisors of 44 but 33 isn't, so 33 is the minimum positive integer that isn't a divisor of 44. Thus, f(4)=3f(4)=3.

Therefore, ans=f(1)+f(2)+f(3)+f(4)=2+3+2+3=10ans=f(1)+f(2)+f(3)+f(4)=2+3+2+3=10.

Sample Cases

Case 1

Input

6
1
2
3
4
10
10000000000000000

Output

2
5
7
10
26
366580019

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback