题目:
A Simple Math Problem
1000ms 131072K
描述:
Huanhuan challenges you to a simple math problem.
Define F(x)F(x) as the sum of the decimal digits of xx.
For example: F(123)=1+2+3=6F(123)=1+2+3=6, F(700)=7+0+0=7F(700)=7+0+0=7.
Huanhuan wants you to calculate the sum of F(j) for every i,j that satisfy 1≤j≤i≤n and i,j are coprime.
More formally, calculate ∑i=1n∑j=1i[gcd(j,i)=1]F(j)
输入:
There are only one test case with a single integer n(1≤n≤105)
输出:
Print one integer, the answer of ∑i=1n∑j=1i[gcd(j,i)=1]F(j)
样例输入:
3
样例输出:
5
翻译:
描述:
欢欢向你挑战一个简单的数学问题。将 F(x) 定义为 x 的小数位数之和。
例如:F(123)=1+2+3=6, F(700)=7+0+0=7.
欢欢想让你计算出对于每一个i,j 的F(j)的总和,满足1≤j≤i≤n 且i,j互质。更正式地说,计算∑i=1n∑j=1i[gcd(j,i)=1]F(j)。
输入:
仅一个测试用例,一个整数n(1≤n≤105)。
输出:
输出一个整数, 问题∑i=1n∑j=1i[gcd(j,i)=1]F(j)的答案。