#abc254d. D - Together Square

D - Together Square

Score : 400400 points

问题描述

给定一个整数 NN。找出满足以下条件的正整数对 (i,j)(i,j) 的数量,其中 iijj 均不大于 NN

  • i×ji \times j 是一个完全平方数。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given an integer NN. Find the number of pairs (i,j)(i,j) of positive integers at most NN that satisfy the following condition:

  • i×ji \times j is a square number.

Constraints

  • 1N2×1051 \le N \le 2 \times 10^5
  • NN is an integer.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer.

Sample Input 1

4

Sample Output 1

6

The six pairs (1,1),(1,4),(2,2),(3,3),(4,1),(4,4)(1,1),(1,4),(2,2),(3,3),(4,1),(4,4) satisfy the condition.

On the other hand, (2,3)(2,3) does not, since 2×3=62 \times 3 =6 is not a square number.

Sample Input 2

254

Sample Output 2

896

update @ 2024/3/10 10:49:33