i am getting segmentation fault for this code.Though I have applied the optimized approach by taken care of the given constraints
Hackerblock prime visit problem
do some more changes
-
declare “p” and “cum_sum” array globally
-
The 500,000th prime is 7,368,787. so make size of array atleast 7400000
you can see the changes in modified Code
Modified Code
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like
: and don’t forgot to mark doubt as resolved 