Could someone please explain how to solve this problem: Prime Number
It’s from an old contest and I haven’t been able to find a clearer explanation of the solution. Thank you and please do not ignore if you can solve it and explain.
EDIT: After 2 to 3 hours of painstakingly searching for a vivid explanation, I sat down to burst my brains out on the problem. Suffice to say, I am very satisfied and at peace with finding how to obtain the solution and why the solution works by myself after spending quite a lot of time. Below are shots of my notes for the problem. For anyone who needs it.
NB: I gave up on the problem and checked the editorial in reasonable time. I just wasn't satisfied with the explanation. I also found the problem interesting urging me to dig more. If there are any improvements, questions, mistakes or suggestions please comment below.
gridnevvvit
Don’t understand why the downvotes (as if I care) but I didn’t say the editorial wasn’t good. I just don’t understand it (probably skill issue) and would want a different perspective or a similar one but with different wording.
My submission is pretty self explanatory
Actually, I wanted to understand the underlying math and how to get to the solution. I have the understanding now. Thanks though for the efforts :)