#3770
Largest Prime from Consecutive Prime Sum
medium · 38.9% accepted · 63 likes · top 18%
array · math · number theory
Description
You are given an integer n.
Return the largest prime number less than or equal to n that can be expressed as the sum of one or more consecutive prime numbers starting from 2. If no such number exists, return 0.
Solution