CF1542C.Strange Function

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

令 f(i)f(i) 表示不整除 ii 的最小正整数 xx。

计算 ∑i=1nf(i)\sum_{i=1}^n f(i) 对 109+710^9+7 取模的结果。换言之,计算 f(1)+f(2)+⋯+f(n)f(1)+f(2)+\dots+f(n) 对 109+710^9+7 取模的值。

输入格式

The first line contains a single integer tt (1≤t≤1041\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 (1≤n≤10161\leq n\leq 10^{16}).

第一行包含一个整数 tt(1≤t≤1041\leq t\leq 10^4),表示测试用例的数量。随后是 tt 个测试用例。

每个测试用例仅有一行,包含一个整数 nn(1≤n≤10161\leq n\leq 10^{16})。

输出格式

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.

对于每个测试用例,输出一个整数 ansans,其中 ans=∑i=1nf(i)ans=\sum_{i=1}^n f(i) 对 109+710^9+7 取模。

输入输出样例

  • 输入#1

    6
    1
    2
    3
    4
    10
    10000000000000000

    输出#1

    2
    5
    7
    10
    26
    366580019

说明/提示

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.

在第四个测试用例中,n=4n=4,因此 ans=f(1)+f(2)+f(3)+f(4)ans=f(1)+f(2)+f(3)+f(4)。

  • 11 是 11 的约数,但 22 不是,因此 22 是不整除 11 的最小正整数。故 f(1)=2f(1)=2。
  • 11 和 22 是 22 的约数,但 33 不是,因此 33 是不整除 22 的最小正整数。故 f(2)=3f(2)=3。
  • 11 是 33 的约数,但 22 不是,因此 22 是不整除 33 的最小正整数。故 f(3)=2f(3)=2。
  • 11 和 22 是 44 的约数,但 33 不是,因此 33 是不整除 44 的最小正整数。故 f(4)=3f(4)=3。

因此,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。

输入解题思路,AI测评打分。不知道怎么写?

首页