olenihc's blog

By olenihc, history, 8 years ago, In English

Hi!

I've come across this piece of code of a (modified?) sieve and I'm trying to figure out what sieve[i] means and how it works, specially the 2nd for.

Would you help me, please?

Thanks!

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

By olenihc, history, 8 years ago, In English

I've come across this probability problem and could not solve it. In order to learn, I searched for the solution on the internet and found out that people just printed 1/2. i.e., the answer, no matter the value of n, is always 50%.

Why is that so? I tried making some DP for testing values under ~20 and only when n = 2 the answer is indeed 1/2.

Can someone give me some help on this tough (for me) one?

Appreciate the help!

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it