#A. C - Sum of gcd of Tuples (Easy)

    传统题 1000ms 256MiB

C - Sum of gcd of Tuples (Easy)

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

C - Sum of gcd of Tuples (Easy)

Score : $300$ points

Problem Statement

Find $\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}$.

Here $\gcd(a,b,c)$ denotes the greatest common divisor of $a$, $b$, and $c$.

Constraints

  • $1 \leq K \leq 200$
  • $K$ is an integer.

Input

Input is given from Standard Input in the following format:

KK

Output

Print the value of $\displaystyle{\sum_{a=1}^{K}\sum_{b=1}^{K}\sum_{c=1}^{K} \gcd(a,b,c)}$.


2
9

$\gcd(1,1,1)+\gcd(1,1,2)+\gcd(1,2,1)+\gcd(1,2,2)$ $+\gcd(2,1,1)+\gcd(2,1,2)+\gcd(2,2,1)+\gcd(2,2,2)$ $=1+1+1+1+1+1+1+2=9$

Thus, the answer is $9$.


200
10813692

2024寒假入门组刷题营(六)

未参加
状态
已结束
规则
ACM/ICPC
题目
8
开始于
2024-2-3 13:30
结束于
2024-2-3 15:30
持续时间
2 小时
主持人
参赛人数
10