plz rectify this…
In your solution there is a line-
p3=i*i*i<n is wrong, you are thinking that p3 is assigned
i*i*i, but instead it is assigned
i*i*i<n, as comparison(<) has higher precedence than assignment(=).
Now what happens is : p3 gets value 0 or 1, based upon the comparison :
Incorrect value of p3 is used. Plus you need to check value of j so that p1 does not become negative. As
isprime(p1) is accessing array, a negative offset will cause SIGSEGV.
To fix this, put parenthesis to force assignment first -
((p3=i*i*i)<n), and fix the loop iterating over j.
For general information on SIGSEGV read my answer here.