how to solve ALICESIE on spoj. How it has common pattern for its answer
how to solve ALICESIE on spoj. How it has common pattern for its answer
What is the logic behind pattern i.e.(ans=(n+1)/2) in question ALICESIE on spoj.
Algorithm_given:
1.Create a list of consecutive integers from N to 2 (N, N-1, N-2, ..., 3, 2). All of those N-1numbers are initially unmarked.
2.Initially, let P equal N, and leave this number unmarked.
3.Mark all the proper divisors of P (i.e. P remains unmarked).
4.Find the largest unmarked number from 2 to P – 1, and now let P equal this number.
5.If there were no more unmarked numbers in the list, stop. Otherwise, repeat from step 3.
Find total number of unmarked numbers.
i know its O(sqrt(n)) solution but answer is expected in O(1),it can found by seeing the common pattern i.e.(N+1)/2
But how to prove it Mathematically
link: ALICESIE
so should i paste whole question here
– Navneet Hingankar
Jul 1 at 0:29
Yes, you should paste or summarize the question here. Just as important, you should show us some of the work you have done on the problem. We will not do all the work in helping you in a contest.
– Rory Daulton
Jul 1 at 0:39
You did a pretty good job in summarizing the problem, so your question is no longer link-only. The question is now improved. However, you still have not shown any work of your own on the problem. Also, the question now is clearly a mathematics problem, even if it was stimulated by a programming problem. You should ask this question at Mathematics Stack Exchange after adding more of your own work and explaining just where you are stuck.
– Rory Daulton
Jul 1 at 5:42
actually i dont know how to prove it,as for me its just coincidence, but there must be mathematical proof behind it, i want to just perceive that.
– Navneet Hingankar
Jul 1 at 7:01
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I'm voting to close this question as off-topic because it is a "link-only" question; its meaning depends on a document elsewhere, which could change or vanish at any time.
– Beta
Jul 1 at 0:14