Problem 2337. Sum of big primes without primes
Inspired by Project Euler n°10 (I am quite obviously a fan).
With problem n°250 by Doug, you can find some global methods to compute the sum of all the primes below the input n.
For example, the sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
But how to proceed (in time) with big number and WITHOUT the primes function ?
HINTS: sum(primes(n)) is possible here but why miss the wonderfull Sieve of Eratosthenes ?
Solution Stats
Problem Comments
-
2 Comments
Rafael S.T. Vieira
on 8 Aug 2020
Be careful, I've implemented the sieve, but not all versions of it are sufficiently fast to handle the biggest numbers in the test suite.
Yunpeng Teng
on 7 Dec 2020
While evaluating the solution, the server encountered an error caused by long running MATLAB code. Edit the code if needed and then submit.
Solution Comments
Show commentsGroup

Project Euler II
- 12 Problems
- 51 Finishers
- Sums of cubes and squares of sums
- Sum of big primes without primes
- Project Euler: Problem 11, Largest product in a grid
- Highly divisible triangular number (inspired by Project Euler 12)
- Divisors for big integer
- Large Sum (inspired by Project Euler 13)
- Longest Collatz Sequence
- Project Euler: Problem 16, Sums of Digits of Powers of Two
- Project Euler: Problem 18, Maximum path sum I
- Recurring Cycle Length (Inspired by Project Euler Problem 26)
- Numbers spiral diagonals (Part 1)
- Numbers spiral diagonals (Part 2)
Problem Recent Solvers141
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!