Sum of Prime (PRIMADD) - Editorial

Sum of Prime (PRIMADD)

Problem link -LINK
Author- Rishabh Verma
Tester - Manas Rawat
Editorial By - Aagam Jain

Difficulty : Medium
Problem Tag : Primality tests , Miller-Rabin primality test

Problem :
Find sum of all prime numbers between M to N (including M or N if they also prime ).

Explanation :
This is the simple question in which you have to find the sum of all prime numbers in the range of M to N .
The difficulty of this question is increase by its test case only , because the value of M ,N may goes upto 10^12. Here we have to do primality test of numbers by which can process the big value like 10^12.
So this thing is been done by and algorithm known Miller-Rabin primality test.

As you calculate prime numbers between M,N then simply add them and print the result.

Read more about Miller-Rabin primality test here .

My Solution :
LINK

1 Like