{"problem":{"name":"2017-like Number","description":{"content":"We say that a odd number $N$ is _similar to 2017_ when both $N$ and $(N+1)/2$ are prime. You are given $Q$ queries. In the $i$\\-th query, given two odd numbers $l_i$ and $r_i$, find the number of odd ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc084_d"},"statements":[{"statement_type":"Markdown","content":"We say that a odd number $N$ is _similar to 2017_ when both $N$ and $(N+1)/2$ are prime.\nYou are given $Q$ queries.\nIn the $i$\\-th query, given two odd numbers $l_i$ and $r_i$, find the number of odd numbers $x$ similar to 2017 such that $l_i ≤ x ≤ r_i$.\n\n## Constraints\n\n*   $1≤Q≤10^5$\n*   $1≤l_i≤r_i≤10^5$\n*   $l_i$ and $r_i$ are odd.\n*   All input values are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$Q$\n$l_1$ $r_1$\n$:$\n$l_Q$ $r_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc084_d","tags":[],"sample_group":[["1\n3 7","2\n\n*   $3$ is similar to 2017, since both $3$ and $(3+1)/2=2$ are prime.\n*   $5$ is similar to 2017, since both $5$ and $(5+1)/2=3$ are prime.\n*   $7$ is not similar to 2017, since $(7+1)/2=4$ is not prime, although $7$ is prime.\n\nThus, the response to the first query should be $2$."],["4\n13 13\n7 11\n7 11\n2017 2017","1\n0\n0\n1\n\nNote that $2017$ is also similar to 2017."],["6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49","4\n4\n1\n1\n1\n2"]],"created_at":"2026-03-03 11:01:14"}}