Friday, February 03, 2012

Teaching the kid how to factorize

So, one day when I return home, I find my wife desperately trying to teach the kid how to find all factors of a number in vain. The kid was unable to comprehend how to do it. After watching for a while, I decided to step in.

With the background in programming coming handy, I first explain what are prime numbers. Then, using the divide-and-conquer method, I show how to factorize.

For example, if the number is 36, I first say that the number itself and 1 are two of the factors.

36 = 36 x 1

Then, we choose a single factor which will divide the given number. For example, 9.

36 = 9 x 4

Now, repeat the above method for each of the factors until you reach prime numbers - numbers that cannot be factorized any further.

9 = 3 x 3
4 = 2 x 2

Since 3 and 2 are prime numbers, we are now in a position to find ALL the factors.

36 = 3 x 3 x 2 x 2

Now, form all possible combinations to get all the factors.

36 = 3 x (3 x 2 x 2) = 3 x 12
   = (3 x 3 x 2) x 2 = 18 x 2
   = (3 x 2) x (3 x 2) = 6 x 6


Add the ones found earlier, and that would complete the list of all the factors.

36 = 36 x 1
   = 9 x 4
   = 3 x 12
   = 2 x 18
   = 6 x 6

So, the factors of 36 are:
1, 36, 9, 4, 3, 12, 2, 18, 6

The above method has the advantage of being very fast, but it has the disadvantage that it becomes difficult if it is not easy to find the first factor.

Sunday, January 01, 2012

Happy New Year 2012

A very happy new year. Another new year, another day. This  new year I purchased a new pair of computer speakers - the Bose Companion 20 (a new model, and as usual expensive). The old speakers were less than nearly one-tenth the price of the new ones, but the old ones had nearly conked off.

Sunday, December 18, 2011

Long time, no post...

Its been a long time since I last blogged on this blog. I think this is because of 2 main reasons:

 One, I find no spare time on weekdays. This is in turn because my workplace location has changed and I have to commute about 36 km one way (not an easy task using public transportation in Mumbai).

The other reason is that most of my browsing /  email reading at home happens on the iPad2. And to type anything on the iPad2 is a cumbersome task.

So no blogs, my friend. At least until I return to my PC. This post, by the way, is from the PC.

Sunday, November 13, 2011

The death of the dead zone???

Even as I type this post, a mega-block (a non-availability of railway tracks in railway parlance) on the Western Railway suburban section draws to a close. This was due to the conversion of the electrification from DC to AC. While the lines north of Borivili were already AC-electrified, this work would mean that the lines would be converted to AC from north of Vile Parle instead. With that, in all probability, the neutral "dead zone" (which is currently at Borivili) would be shifted to Vile Parle. And, within a few months, the dead zone would be all gone as the entire suburban section would be AC-electrified.

Tuesday, November 08, 2011

Another Bengaluru trip

This evening I fly into Bengaluru for some work related conference. I am not carrying the heavy laptop, instead choosing to opt for my android mobile for emails / browsing. Since I do not have a SIM card in the device, I will have to rely on the WiFi connectivity instead. Usually, many conference venues, airports, and hotels have a WiFi connectivity. I hope this works out. Will post back the results here.

Update: This idea is working out quite well. WiFi access at Mumbai airport, accommodation, as well as at the venue. Good riddance to heavy laptops?

Update 2: I reached Mumbai late on Thursday evening (10th November). Like I mentioned in the earlier update, the idea of using the Android phone worked very well. Apart from the free WiFi access mentioned above, there was also free WiFi access available at Bangalore International Airport, except that the one at Bangalore restricted free access for 45 minutes. If more access was required, one was supposed  to buy additional access from online or some counter at the airport. I did not bother to buy additional time.

In hindsight, all one does is to check and reply to emails. All of this can be done easily today using a smart phone. Of course, typing long memos / documents is a pain, and obviously, one will also not have access to a development environment, but in a short trip such as this where a majority of the time is spent in attending the conference talks, this is hardly a priority.

Thursday, October 27, 2011

In Dharwad, this Diwali...and back

This Diwali I am spending spent a quiet vacation in Dharwad. The weather is was cool and pleasant - perfect for a vacation. And, by the end of the week, we are back in Mumbai all charged up.

We had 3 weekdays off for the Diwali festival starting Wednesday, and adding the 2 weekend days meant a really long weekend vacation. The decision to visit Dharwad was taken late, and it was quite difficult to get train tickets at such a short notice, so we had to travel by bus. We went by a Volvo bus of VRL Travels, one that has lot of services on this route.

We left on Tuesday evening (after work) and  reached back on Sunday (today). The journey to Dharwad on Tuesday was quite tiring - the bus arrived about an hour late (traffic) at our boarding point, there was horrendous traffic (hordes were going away from Mumbai for Diwali), we had a flat tyre, I had dinner at 1:30 a.m., and until 6:30 a.m. in the morning we were still in Kolhapur.

Then, things changed for the better - a new expressway from Belgaum meant that we reached Dharwad in just 2 more hours at around 8:30 a.m.

The return journey was short and with no incidents - we reached in about 8 hours.

In Dharwad, we spent playing (badminton and other iPad games), praying (at various temples), and eating (Diwali!!!). The climate, as I mentioned, was very much pleasant - it was also cold at certain times due to sporadic rains. We spotted several types of birds, and a mongoose and squirrels. Oh! and by the way, although we did not visit the railway station this time, we could still hear the short powerful horns of the diesel locos - no doubt of the WDP4s / WDG4s of the UBL (Hubli) loco sheds.

All in all it was time spent well - a much needed  break from the polluted environs and hectic life of Mumbai. I can still feel the cool breeze and the fresh air of Dharwad. Need to stop dreaming and wake up - its back to the grind from tomorrow.



Thursday, September 29, 2011

iPad2 bought

Just bought a new toy, the iPad2. I must say that I was inspired by my cousins (R from the USA, and R from Bengaluru). Indeed the whole wifi setup done at home recently was geared towards the ipad2 in mind. This post has been posted from the iPad.