Tap here to switch tabs
Problem
Submissions

Problem: Largest Prime from Consecutive Prime Sum

Try to solve the Largest Prime from Consecutive Prime Sum problem.

Statement

Given an integer n, return the largest prime number less than or equal to n that can be expressed as the sum of consecutive prime numbers starting from the first prime number 22. If no such prime number exists, return 00.

Constraints:

  • 1≤1 \leq n ≤5×105\leq 5 \times 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Prime from Consecutive Prime Sum

Try to solve the Largest Prime from Consecutive Prime Sum problem.

Statement

Given an integer n, return the largest prime number less than or equal to n that can be expressed as the sum of consecutive prime numbers starting from the first prime number 22. If no such prime number exists, return 00.

Constraints:

  • 1≤1 \leq n ≤5×105\leq 5 \times 10^5