Monday, January 02, 2012

New year resolutions

Am going to stick my neck out and publish these resolutions:
  • Be fitter than I am now. Loose 5 kgs this year. My body should not pain after a trekking or a game of football/badminton etc. Be active.
  • Get my financial life in order. Ensure that I have enough emergency fund, look at health insurance, save enough for flat possession in October.
  • Look for ways to get a second income. Don't say no to any opportunity - no matter how ridiculous it sounds. Think of and start at least one plan. Focus on one thing at a time, be it at office or at home.
  • Revitalize my blog. - Writing garbage is better than writing nothing. Write at least 12 articles in this year.
  • Bonus: Observe/analyze my reaction on various stimulus and try to correct it. Make behavioral changes to be more at peace with everything. Calm and slow down.

There is my list. All these goals are Specific, Measurable, Attainable, Realistic and time bound. (Leaving last one, can't be measured by me and no particular actionable item). I hope to achieve them.
I have done not badly with new year resolutions for last two years but never documented them in public domain. I think it'll do me good.

Will review these every month and post the results in December 2012. Till then, happy new year to all of you.. May all your resolutions come true, may you get what you deserve - not more, not less.

Labels:

My birthday

Its my birthday today. Happy b'day to me.. :)

Friday, April 25, 2008

The sword problem

This is one more interesting problem - there are n persons standing forming a circle. The first person has a sword, he kills 2nd person and hands over the sword to the 3rd person. He kills 4th and gives it to 5th and so on... (Remember that these persons are in circle, so if last person gets the sword, he will kill 1st.)
Problem is - given the value of n, find out the person who will survive.

Scroll down to find the solution to this problem, but I urge to take some time to solve this one - Thats where the fun is :)































To solve this problem, I divided the problem in two parts. Lets take the case when n is even and then think about the odd n.
I also wrote a small python program to see the result and then try to map these results with some known series like fibonacci etc.
I am pasting my code here -

mylist = []
j = input("Enter the last number upto which we need to calculate this: \n")

#Add values
for i in range(1,j+1):
mylist.append(i)
num = 1
while len(mylist) != 1:
del mylist[num]
num = (num + 1) % len(mylist)
print "\n And the no. remaining is : ", mylist

With this, I came to know that if n is even, result is always 4x+1.
If n is odd, result follows 4x+3.
But I couldn't get any relation between x and n.

Then I realized one more phenomena - no matter if n is even or odd. There is some relation in n and the next no. which is power of 2.
Take n = 1000. (result is 977.)
next no which is power of 2 = 1024.
difference = 1024-1000 =24
subtract 24 from 1000 = 976.
Add 1 = 977. (We have the answer).

Lets try odd n.
let n = 999.
next no. which is power of 2 = 1024.
1024-999 = 25.
999-25+1 = 975 - which is the real answer!!!

I won't give more example here, but I tried more and they were all matching up.

One of my friends suggested that if I convert the no. to binary and then add all powers of 2 where 1 occurs and add all powers of 2 where 0 occurs and then subtract the two, I have the answer.
e.g. take 5 = 101.
1's are on 0th and 2nd position - add them 2^0+2^2 = 5.
0's are on 1st position - add them 2^1 = 2
subtract both 5-2 =3 - this is our answer.

On further thinking, adding 1's is not necessary as it will always result in the no. itself. :)

Labels:

Monday, April 21, 2008

The juice problem

For quite some time, I was trying to solve the following problem -
You have a party coming and you have ordered 1000 bottles of juice. The party is about to start in one hour and suddenly you come to know that one of the bottles is poisonous - the person who drinks it would die exactly in one hour (without showing any symptoms, just suddenly drop dead!).
Now, you don't want to ruin your party, but you certainly don't want your guests to die. Hence, you get 1o guinea pigs(Assume they behave exactly as humans once given juice). Your aim is to find the bottle which contains the poison.
I spent a lot of time to solve this one. Lets see how long does it take for you. :)

Will put solution in the comments section....

Labels:

Sunday, March 09, 2008

Swami Vivekananda Part 1

Currently, I am reading a book from Swami Vivekananda. I am always interested in discussing and thinking about religion as whole and Hindu religion in particular.
The work of Swami Vivekananda makes you think. I hardly read 20 pages and got into a lot of thinking. I grew up reading in RamKrishna Mission libraries which has left an impression on me, and things which you pick up in childhood are really difficult to un-pick.
That said there are a lot of things with which I don't agree with. And then there are things which I agree with, but the manner in which he speaks, I WANT to refute.
He says, "Verification is the perfect proof of a theory." This is exactly the thing I am taught to challenge in Science. If I can give 100 examples of some theory working, it doesn't make it right. Proof by example doesn't work - refute by example does. However, I agree that verification is the ONLY tool currently available for proof.

So much for now, I need more coherent thoughts on this one. Will continue later.

Labels:

Monday, August 27, 2007

So much for the laugh

My God! I have laughed a lot from Sunday to Monday. On Sunday, we went to Meenoo, Shyamakshi and Mousmi's house for the lunch. Boy, are these girl mad! For full 5 hrs, I made fun of them and they kept on giving me a lot of opportunities. Mousmi acts so stupid that I just can't stop laughing whenever I am with her.
And today, Chanu was at her best. She told me that she dropped her iron today causing it to break. Then she went to make "Pulao" and found something lying beside the box of rice, when she poked at it (No joking! she really did it.), it started to move!! Big wonder :)
Bloody worm was eating her sweater as well - that ugly, distasteful, sinful buster. So she bought some naphthalin and put it in. My first response was - what? you put naphthalin in rice? And her response - that's what mom said, "have you gone crazy?". I was speechless .... I still am.

Labels:

Monday, August 20, 2007

Feels great to see my posts in my rss feeds

I am going to let out a secret! It feels great to see my own posts in my own rss feeds a.k.a. G-Reader. Every time I see my post followed by the no. of new items, my heart leaps. Today it's showing 3 and after this post, it would be 4. I don't want to read them and make them disappear.

I know it's stupid but that's how it is. Today was a typical Monday, I got stuck heavily in traffic and reached office at 11.30 AM. Then did a few things, Mario wasn't in office. I am re-reading Calvin and Hobbs and it's great. The only thing remaining is the book, "World is flat" which I need to finish. Lets hope I do that.

Labels: