Prime sum
Practice
3 (4 votes)
Special numbers
Counting
Implementation
Math basic
Basic programming
Basic math
Basics of implementation
Sieve
Math
Problem
94% Success 1604 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a number \(N\). Find all pairs of prime numbers \((L,R)\) such that \(L ≤ R\) and their sum is also a prime number and no more \(N\).

Input format

The first line contains a single integer \(N\).

Output format

The single integer is the number of pairs that satisfy the condition.

Constraints

\(1 ≤ N ≤ 10^7\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
94 votes
Tags:
MathematicsOpenApprovedEasy
Points:20
7 votes
Tags:
Dynamic ProgrammingRecursionAlgorithmsEasyMathematicsOpenApproved
Points:20
21 votes
Tags:
Bit manipulationBasic ProgrammingApprovedEasyBit manipulation