問題一覧 > 通常問題

No.843 Triple Primes

レベル : / AI推定難易度 : 700 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 281
作問者 : Tlapesium / テスター : yuki2006
お気に入りにしたユーザー ProblemId : 2855 / 自分の提出
問題文最終更新日: 2019-03-18 23:10:42
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 216 (順位表) の他の問題:

Problem Statement

Find the number of tuples $(p,q,r)$ of primes not exceeding $N$ that satisfy $p + q = r^2$.

Input

$N$

Constraints

  • All inputs are integers.
  • $1 \le N \le 5 \times 10^5$

Output

Output the answer on a single line.

Sample

Sample 1
Input
10
Output
3

$(p,q,r) = (2,2,2),(7,2,3),(2,7,3)$ satisfy the condition.

Sample 2
Input
500000
Output
81

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。