Sunday, January 30, 2005

The progrmming contest season begins

Bad enuf that we missed out on pragyaan and vortex 05 well finally we'v finished with IIIT, H 's
CodeCraft 05.
http://codecraft.iiit.ac.in/cgi-bin/results.cgi
mself 'n praveen, my "time out" dude who wants to use recursion and exhaustive search in any and every problem. Starting off with our once in a lifetime IITb ACM ICPC..we'v come a long way..

Finally we'v managed to come to 46th position, praveen having solved 2 problems after a lot of
nagging errors... compilation, segmentation, time out.. wot not.. well finally he's did it i say.
Well my pathetic show continues. Tho managed to solve 3 problems i somehow have missed out on some really clever test inputs..which i'm still to figure. As far as i'm concerned i'v solve
Superhero,Aliens and the Tiling problem... for the first time without using exhaustive search.

The good news is that we'v improved..at least i'v stopped depening on my trustworth "permutation" program. Nice to know that my soln's are at least clearing the time out limit. Only problem is the incorrect solutions.. at least i'm happy that we r improving by every contest..managing to beat even quite a few IITians. :)

The beauty of a programming contest is that u don't realize time flying by, u are always trying
to figure out how to make a computer think like you... man, the human brain is really amazing...
Programming is FUN..! looking fwd to the nxt contest..! Must keep saying to myself "someday i'll be there"...! where?

Learnings:
Don't depend on recursion unless its the last problem u r trying
U'll get a compilation error if ur file extension is ".C" instead of ".c"
Segmentation error most often occurs due to small array size

Finally i'v got the hang of debugging in C using standard tools... all thanks to the training i
received at CornerStone project @ HCL.

Ending note:
Sidhu's comment about women's cricked in India:"i'd rather go and see Kangaroos hopping in a zoo than going to a stadium to watch women's cricket"...!

Friday, January 28, 2005

Prime Rules

Ever tried to know if the prime number series was finite or not?


Well here's is the most logical proof i'v come across

Now assume that u'v gone all over the world counting primes and now u'v ended up with..
2,3,5,7.....pm,..pn (where pn is the last prime u'v encountered and now think that that's u'v finally managed to compute the last prime... (pn).. and u say that's the last prime no. in the numeric system.

Well here's how the proof goes:
------------------------------------
if u say that u'v managed to get nos. upto... pn and say adamantly that pn is the last prime..
here's wot i say....

First i assume that there exists some no..pk that is greater than pn...and it is computed as such..
pk=[2*3*5*7*.....(all primes)...*pn] + 1

Clearly this a no. greater than the no. u'v arrived at... Agree?

Now u ask me how can i say that pk is a prime no.?

Well....wot is the property of a prime no? - It must not be divisible by any no. other than itself and 1.. and if i mean "any no." it means that no. is either a prime or a composite (product of primes).. so i'm taking the superset by saying that:" For a number to be prime, it must not be exactly divisble by any other prime no. " ... Agree?

So now coming back to my pk,
Divide pk by 2 (That's the first prime right).. u get a remainder of 1
Divide pk by 3,5,...7.. etc.....................u always get a remainder of 1.
Now divide pk by pn (that's the larged prime that u'v computed)... u still get a remainder of 1..

Now 'lo and behold'...we'v come to the conclusion that pk is not divisible by any prime without leaving a remainder.. !

SO FINALLY I PROVE TO U THAT THERE EXISTS A PRIME pk THAT IS GREATER THAN pn..!!!!!

So logically there exists a prime that is higher that the highest prime... no recursively,..consider pn=pk, u'll by the same proof arrive at another pk which is still larger and still a prime, HENCE THERE WILL ALWAYS BE A PRIME ....and THE PRIME SERIES IS INFINITE! .. huh.QED

Corollary:
----------
(1) Did u know that the product of any no. of primes + 1 is always a prime... No? Well think about it.. 3=2+1 5=2*2+1 7=2*3+1 11=2*5+1 13=2*2*3+1 ... etc..

Also, Every prime can be expressed as 6x (+ or -) 1

Maths is fun..!

Ever heard of Catalan Numbers, well that's another interesting series that' i'll have to find more about

Thursday, January 06, 2005

Trips, Cakes and .NET

A trip down to Kerala, some things i gave a thougt to:
Top reasons y i like god's own land..( Kerala )
1. The soft water ( no where else have i seen soap lather so well in water )
2. The flora ( Trees trees everywhere )
3. The fauna ( u can encounter nething and everything that crawls, slithers, flies.. wot not )
Top reasons y i don't like it
1. Hartals, striks and for ne stupid reason, just to have an end to daily life..!
2. The lack of provisonal stores and other neccesity stores nearby
3. The rash bus driving clubbed with the narrow roads.

well by b'day, first time i'm having more than a couple of ppl to celebrate and cut the cake with, first time i'm celebrating it a day in advance, first time i'm getting more than 1 gift ( i'v always got that 1 gift from my bestest friend )...first time i'v had a cake smeared on my face on my face for my own b'day!

Realizations:
1. The word "oh" can be used in a varity of situations leading to the desired meaning
2. When a baby become to heavy for u, u stop calling it a baby.
3. U can loose ur identity in a big room filled with s/w enggns
4. Friends will still remmeber u when it matters most..!
5. Nuances are meant to be pondered upon.
6. U never always get wotever u want in life.
7. Underground rooms are the best place to sleep in
8. Accent is something that will be picked up in 2 yrs without u knowing it..!
9. Time flies

Being put into a new project really can take a toll n ur life.. especially if its gonna deal with technologies(.NET) u have no idea about.... so as of now hardly get time to do nething... that applies to thougts ...and hence blogs... the reason y i'm not able to update this page as frequently as i thought.... the only good thing abot the whole thing is that i'll finally have something to add to my resume..!