Monday, September 17, 2018

Anvesh's dictionary

My son Anvesh's dictionary:

Moongphali - Moong nini
Mickey Mouse - Mi nananan
Tu ganda bachcha
Teri techi techi

मूँग निन्नी  - मूंगफली
मी नन्नन - मिक्की माउस
तू गन्दा बच्चा - bad boy
तेरी तैची तैची - तेरी ऐसी की तैसी
मम्मा/पापा गुस्सा मत करो!
आँसू आ गए हैं ! - when he is weeping and no one is paying attention.
बेबी को फ्रिज लॉक करना है
किसकी आवाज़ आई? - when some animal/car/bus etc makes some noise - esp peacock
चलो दुद्धू बनाया जाये! - In the morning when he wakes up.  

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 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:

Scott adams advising another cartoonist

This is a new form of reality shows... Scott Adams has found one cartoonist guy (also named as Scott) and is giving him advice. If things stopped at that, there would have been no news at all; but he is giving him advice in public i.e. - he gives him advice and then updates it on his blog and then ask his readers (including me) to give advice too.
This new Scott guy would be happy about it - after all, he is getting free publicity. And Adams is gaining the pleasure of knowing that he is helping a new guy. If he makes it big, Adams can always say that he is his "God-Father" and the readers are happy too giving free advice on a matter none of them has any experience at all.
What ensues, is really interesting - just like some reality tv show, Adams keeps us informed by his blog updates and asks us to comment. So far 6 updates have been posted.
I am writing this because I want to keep writing. Its not that I particularly wanted to write this thing, but I had to do my daily writing and all I could summon was this. :)
Hopefully, within 1 week, my writing will start showing some improvement.

Labels:

Friday, August 17, 2007

Benefits of working

"Teach the thing you want to learn yourself." Lets discuss why I consider working better than non-working.
1. It gives you happiness - Think about it, when were you very happy? Was it the day in which you did nothing, or was it an action packed day? Even if your answer is earlier, I am sure it happened after some very hectic days.(There is nothing like rest after a long day or week).
2. No mental blocks - When you do work, you don't feel guilty - you have completed your duty. This relieves all mental pressure.
3. It's the most natural thing - "A man's basic nature is to act and not to be acted upon." - Steven Covey. So, you are being more natural when you do things as opposed to when you don't. Active voice is better than passive.
4. Feeling of worthiness - When you do work, it feels that you are worthy and not piggybacking on the world. You are carrying the world along with you. You can make things change... It is such a nice feeling that I can't explain it.

Labels: