問題一覧 > 通常問題

No.1657 Sum is Prime (Easy Version)

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 207
作問者 : 👑 箱星 / テスター : LayCurse ygussany
お気に入りにしたユーザー ProblemId : 6753 / 自分の提出
問題文最終更新日: 2022-04-26 00:04:10
Sum is Prime (Easy Version)
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. Show the original
yukicoder contest 311 (順位表) の他の問題:

Notice

The only differences from the Hard Version are the constraints and the time limit.

Problem Statement

You are given positive integers $L,R$ satisfying $L\le R$. Find the number of pairs of integers $(A,B)$ that satisfy the following $2$ conditions.

  • $L\le A\le B\le R$
  • $A+(A+1)+\cdots+B$ is prime

Constraints

  • $1\le L\le R\le 10^6$
  • All input values are integers

Input

$L$ $R$

Output

Output the number of pairs $(A,B)$.

Sample

Sample 1
Input
1 4
Output
5

There are $5$ such pairs: $(A,B)=(1,2),(2,2),(2,3),(3,3),(3,4)$.

Sample 2
Input
7 7
Output
1

Sample 3
Input
132422 969076
Output
185373

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