Friday, September 22, 2006

Bible and Number Theory

The first three verses from the Bible (KJV)

1:1 In the beginning God created the heaven and the earth.

1:2 And the earth was without form, and void; and darkness was upon
the face of the deep. And the Spirit of God moved upon the face of the
waters.

1:3 And God said, Let there be light: and there was light.

Now we have 10 words in the first verse. Start at any of the 10 words. Now count the letters in that word. If it is N go to the Nth word from that. Count the letters again and repeat the procedure. When you reach the third verse you will always end up in the word God, no matter from where you started!

eg. Let's begin from  (the word) "beginning"  itself.

it has 9 letters, so i move to the 9 th word from there which is "the" ( second word in the second verse). Now it has 3 letters so i go to the third word from there which is "without" which has seven letters
now repeating the procedure : beginning--the--without--upon--the--God!

Does this imply that God exists and the Bible is the ultimate proof for it? ;)

The Game of Four Fours

The rules of the game are like this

Make any positive integer from 1 to inifinity using four fours.

1) you can use four 4s
2)you should always use four fours.
3)you can use any mathematical operators any number of times
4) you can use brackets
5)you can use the factorial symbol any number of times (4!!!!!!!!!!!!!!!!!!!!!!!!)
6)you can use constructs like four raised to four; four raised to four raised to four
7)you can use the square root symbol any number fo times
8)you can use the decimal point (4.4 or .4 etc )
9)you can use dot above four ( eg: 0.44444444444444444444444444444..... can be represented by .4 with a dot above the four )

Some  samples below.

1= 44/44
2=(4*4)/(4*sqrt (4))
3= 4/4+ 4/(sqrt (4)) =(4+4+4)/4
..........................................................

9 = 4/.444 with a dot above the last four

now try making the numbers upto 100 (provided you have time) and especially 37,39,53,57, and 59.

This has been my favorite pass-time once.

Thursday, September 14, 2006

Programmer's day special

Hi all,

Today being programmer's day (I dont know whether there is actually such a day :but what they tell is today is the 256th day of the year and 256 is the number of values representable by a byte of data ) let me post two good C -puzzles I have seen.

Q1) The first question is write code in the change function so that the printf in main prints 5.You should not modify the main function and u shud not use printf in the change function

#include
void change()
{

/*write code here*/

}
int main()
{
int i;
i=5;
change();
i=10;
printf("%d",i);/* this should print 5*/
}

the solution is

void change()
{
#define i i=5,j
}

so whenever u see "i" it will be replaced by thepreprocessor as
i=5,j that is

int i; becomes int i=5,j;
similarly

i=10 becomes i=5,j=10; //the comma operator

and printf('%d",i ) becomes printf("%d", i=5,j);and printf ignores the second argument.

Q2)WAP in C to print ur name 1000 times without using semi colonsolution

void main (int argc, char **argv)
{
while (printf ("Babu Kalyanam\n") && ( argc++ <=1000)) { } } or you can use rather awkward solution
void main()
{
if ( printf("Babu Kalyanam\n"))
if ( printf("Babu Kalyanam\n"))
if ( printf("Babu Kalyanam\n"))

/*repeat this 1000 times */

if ( printf("Babu Kalyanam\n"))
{}
}

Sunday, September 10, 2006

Will you marry me

*********************************************
When I saw your name next to mine,
In our wedding card,I felt blessed.

When I saw you smile,
Seeing me in the traditional bride groom dress,
I felt teased.

When I held your hand,
During the marriage rituals,
I felt responsible.

When you entered my lonely bachelor life,
And changed it into a heavenly abode,
I felt lucky.

When you showed the same love as I did,
Towards my parents,I felt proud.

When you scolded me,
For neglecting my heath amidst my hectic work,
I felt pampered.

When I saw you scream,
Crying out of labor pains,
I felt helpless.

When I saw tears of happiness in your eyes,
As you looked at our kid,
I felt blessed once again.

All these feeling have bloomed in my heart,
But are yet to blossom in reality.

As these are feelings I long to feel,
For these are still unfelt.

Will you marry me?
*********************************************
PS:
I got it from somewhere, and was kept unpublished till now. Credit belongs to whoever wrote it.
But I like this one very much!!!!