Last Thursday (Oct 2), I happened to be there at Google office in Zurich, Switzerland for the 'Zurich Open Source Jam' event, for just a couple of hours and also got to see the office, which is said to be one of the best places to work (with all the work done and the facilities/benefits provided). Its also said to be the Google's biggest R&D centre, outside US of A.

I spent a couple of hours there, listening to the presentations given by a couple of other developers from Zurich and its surroundings. I haven't been to many events like that before and so, I planned on this event and also thought of spending the weekend, looking around Zurich and some other places in Switzerland and Liechenstein (although it was my third entry into Switzerland).

I started working early in the morning, on Thursday (Oct 2) and took off from work in the afternoon (Friday was a holiday, as it was German Re-Unification Day) and set off to Zurich, by the German ICE train. After reachin' Zurich, I went directly to the Google office, with my huge backpack. After checkin' in and signin' an NDA, I was there for a couple or hours, listening to the presentations given by a couple of developers. It was ok, nothing interesting. I just thought that it would be a nice experience and will get to know what other guys are tryin' to do and get to know the perspective and come up with my own ideas (if any) and try to do something. I'm more interested in the math, algorithms, Java, AJAX, js, scripting languages or any other creative stuff.

Most of the guys who attended were pretty young. Some are studying at ETH Univ, Zurich and some are working. After the event, I got to see the Google Zurich Office and the extra things offered there. Michael Haselmann (Zoogler - who works there) guided us through all this stuff. He's a pleasant guy, with a smile always. Good to see relaxed people like that (specially, in the German world) ;-). Apart from this, I also saw the display screen, at the reception, which shows all the 'Google Search Queries' that are fired by different people across the world. If you happen to be there, you can probably see some funny/weird/naive queries on the screen.

Taking pics inside the office is prohibited, but there are numerous sources on the internet, from where you can check how the 'Zurich Google Office' looks like. Here's one of those links:

Google Office - Zurich

If you wanna check the rest of my trip, follow the link below:

Journal Of A Nomad

### Google Developer Day 2008 - Munich (Germany)

Last month, I was searching for something on the internet and stumbled upon this news that Google is organising its 'Developer Day' event at Munich (Germany)/Munchen (Deutschland). Since I haven't attended many events like that and was interested in Google's tech stuff, I filled up the form on Google's site and got an e-invite from Google folks at Munich. Also, I thought I could meet up with a couple of famous or well-known Googler's and discuss things, personally (although I aint bigtime and just a face in the IT-Crowd) on varied topics like Java frameworks, MapReduce/Apache Hadoop, Cloud Computing and the hype around it, AJAX stuff and new Java frameworks like Richfaces, JBoss Seam, Dependency Injection (which is implemented by many, but not understood by all), et al.

The event was scheduled on Tuesday, Sep 23 2008 and the agenda/sessions for that day was known well-ahead and so, I flicked through the Google pages and went through a couple of technologies like 'Google App Engine', 'OpenSocial', 'Geo', 'Visualization API', 'GData', 'Google Web Toolkit (GWT)', 'Guice', et al. I ran a couple of examples and got an idea about how these technologies are useful and what is the strategy behind this, for Google to release those API's.

I planned my trip so that I could also spend some time in Munich and visit 'Oktoberfest', which is well-known all over the world, for being the biggest folk festival, in the world. Indeed, many people consider this 'Oktoberfest', as a binge-drinkin' event, rather than a normal folk festival, with people dressed up in colourful Lederhosen and Dirndl's (typical Bavarian dress'). Also, it offers a couple of other amusement-park stuff like the 'Free-Fall', et al. So, I went on Monday afternoon by the German ICE train (which sped to a max of 301 km/h and took me to Munich in just 1 hour, from Nuremberg/Nurnberg) and spent sometime lookin' around 'Oktoberfest' (not for binge-drinking. I'd no company, anyways. ;-)) and also checked the location of Google's event, the next day. Here's a post from my other blog, about 'Oktoberfest':

Oktoberfest 2008 - Munich, Germany

The next day, I was there in time for the Google's 'Developer Day' event and attended the keynote by Markus Muhlbauer (Google Munich's Engineering Director) and Chris DiBona (Open Source Manager for Google, who previously worked as a editor for 'Slashdot', hosted 'FLOSS weekly' event and also co-founded 'Damage Studios'). Chris DiBona has good presentation skills, which is mixed up with a bit of humour and other facts. Here are some pics:

After the keynote, I spoke a bit to Chris DiBona and immediately rushed up to the next session (App Engine Code Labs). Since I ran those examples already, I didn't spend much time there. So, I went to the other code lab for 'Google Geo' and spent sometime there, just to get an idea . I also spoke to 2 French employees of Google. One Googler said that he's from South France and I'd a good conversation with him, talking about my 'Monte Carlo and French Riviera trip'. Indeed, I was excited to talk about that, as I like that part of France (which has good weather, sophisticated to laid-back and relaxing places, many things to do, et al).

Later, I met 'Markus Muhlbauer' at Google Lounge and talked to him, a bit about Google Munich's R&D centre, its location and what they exactly do over there. I gotta know that Google Munich's office is located at Marienplatz, Munich (which is the centre and one of the best parts of Munich) and at the moment, there are just a couple of employees working there and that the office aint so big and that they are planning to expand. Here are some pics:

After the lunch break, I also attended 'Google Web Kit' (presented by 'Sumit Chandel') and 'Google Gears' (by 'Dion Almaer'). I was particularly interested in 'GWT' as it relates to Java stuff and also explored a bit of it, already. All the presentations were pretty basic (or 'Just Right') as they have to target all the audience. If you have gone through the Google documentation regarding these technologies, attending this event is not a big deal, but the whole experience and meeting bigtime folks, gives you a perspective (if you are a budding and ambitious developer/user). Anyways, its a freebie and if you attend that, you get more presents as freebies. So, its definitely worth it. ;-) Here's a pic from the 'Google Web Kit' session:

I also spent some time listening to 'Ian Fette',who was presenting 'Google Chrome' stuff. There was a nice Q&A session, at the end of this presentation and got to know a couple of things.

At the end of the day, there was a 'Wrap-up' session, in which 'Chris DiBona' presented some cool things on the mobile and talked a bit about 'Android'. After that, I wanted to talk to 'Peter Chanezon' about 'Cloud Computing' and other technologies, but didn't happen, as he was busy. Apart from that, I was particularly interested in talking to 'Dion Almaer', as I know him pretty well through his 'Ajaxian.com' site/blog. I couldn't speak to him at length, but had a small talk and called it a day and headed back home. Here are some more pics:

If you need more info regarding the sessions, check the below link (which has youtube videos from those sessions on that day):

Google Developer Day 2008 - Munich

The event was scheduled on Tuesday, Sep 23 2008 and the agenda/sessions for that day was known well-ahead and so, I flicked through the Google pages and went through a couple of technologies like 'Google App Engine', 'OpenSocial', 'Geo', 'Visualization API', 'GData', 'Google Web Toolkit (GWT)', 'Guice', et al. I ran a couple of examples and got an idea about how these technologies are useful and what is the strategy behind this, for Google to release those API's.

I planned my trip so that I could also spend some time in Munich and visit 'Oktoberfest', which is well-known all over the world, for being the biggest folk festival, in the world. Indeed, many people consider this 'Oktoberfest', as a binge-drinkin' event, rather than a normal folk festival, with people dressed up in colourful Lederhosen and Dirndl's (typical Bavarian dress'). Also, it offers a couple of other amusement-park stuff like the 'Free-Fall', et al. So, I went on Monday afternoon by the German ICE train (which sped to a max of 301 km/h and took me to Munich in just 1 hour, from Nuremberg/Nurnberg) and spent sometime lookin' around 'Oktoberfest' (not for binge-drinking. I'd no company, anyways. ;-)) and also checked the location of Google's event, the next day. Here's a post from my other blog, about 'Oktoberfest':

Oktoberfest 2008 - Munich, Germany

The next day, I was there in time for the Google's 'Developer Day' event and attended the keynote by Markus Muhlbauer (Google Munich's Engineering Director) and Chris DiBona (Open Source Manager for Google, who previously worked as a editor for 'Slashdot', hosted 'FLOSS weekly' event and also co-founded 'Damage Studios'). Chris DiBona has good presentation skills, which is mixed up with a bit of humour and other facts. Here are some pics:

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

After the keynote, I spoke a bit to Chris DiBona and immediately rushed up to the next session (App Engine Code Labs). Since I ran those examples already, I didn't spend much time there. So, I went to the other code lab for 'Google Geo' and spent sometime there, just to get an idea . I also spoke to 2 French employees of Google. One Googler said that he's from South France and I'd a good conversation with him, talking about my 'Monte Carlo and French Riviera trip'. Indeed, I was excited to talk about that, as I like that part of France (which has good weather, sophisticated to laid-back and relaxing places, many things to do, et al).

Later, I met 'Markus Muhlbauer' at Google Lounge and talked to him, a bit about Google Munich's R&D centre, its location and what they exactly do over there. I gotta know that Google Munich's office is located at Marienplatz, Munich (which is the centre and one of the best parts of Munich) and at the moment, there are just a couple of employees working there and that the office aint so big and that they are planning to expand. Here are some pics:

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

After the lunch break, I also attended 'Google Web Kit' (presented by 'Sumit Chandel') and 'Google Gears' (by 'Dion Almaer'). I was particularly interested in 'GWT' as it relates to Java stuff and also explored a bit of it, already. All the presentations were pretty basic (or 'Just Right') as they have to target all the audience. If you have gone through the Google documentation regarding these technologies, attending this event is not a big deal, but the whole experience and meeting bigtime folks, gives you a perspective (if you are a budding and ambitious developer/user). Anyways, its a freebie and if you attend that, you get more presents as freebies. So, its definitely worth it. ;-) Here's a pic from the 'Google Web Kit' session:

From Google Developer Day 2008 - Munich |

I also spent some time listening to 'Ian Fette',who was presenting 'Google Chrome' stuff. There was a nice Q&A session, at the end of this presentation and got to know a couple of things.

At the end of the day, there was a 'Wrap-up' session, in which 'Chris DiBona' presented some cool things on the mobile and talked a bit about 'Android'. After that, I wanted to talk to 'Peter Chanezon' about 'Cloud Computing' and other technologies, but didn't happen, as he was busy. Apart from that, I was particularly interested in talking to 'Dion Almaer', as I know him pretty well through his 'Ajaxian.com' site/blog. I couldn't speak to him at length, but had a small talk and called it a day and headed back home. Here are some more pics:

From Google Developer Day 2008 - Munich |

From Google Developer Day 2008 - Munich |

If you need more info regarding the sessions, check the below link (which has youtube videos from those sessions on that day):

Google Developer Day 2008 - Munich

### GCJ 2008 - Alien Numbers

'Alien Numbers' problem statement:

Problem

-------

The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.

Input

-----

The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as

alien_number source_language target_language

Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

Output

------

For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.

Limits

------

1 ≤ N ≤ 100.

Small dataset

-------------

1 ≤ num digits in alien_number ≤ 4,

2 ≤ num digits in source_language ≤ 16,

2 ≤ num digits in target_language ≤ 16.

Large dataset

-------------

1 ≤ alien_number (in decimal) ≤ 1000000000,

2 ≤ num digits in source_language ≤ 94,

2 ≤ num digits in target_language ≤ 94.

Sample Input

------------

4

9 0123456789 oF8

Foo oF8 0123456789

13 0123456789abcdef 01

CODE O!CDE? A?JM!.

Sample Output

-------------

Case #1: Foo

Case #2: 9

Case #3: 10011

Case #4: JAM!

There are a couple of ways you can code a solution for this, but if you know (or did some research on) number systems, you can figure out the easiest solution.

My Solution:

------------

Since the 'decimal system' is the easiest that we humans and the programming languages (Higher-Level Languages) can comprehend, I converted the 'Alien Number' (using 'Source Language' input) into a decimal number and then divided that number with the 'base of the 'Target Language' number system) . The remainder is found and if its not zero, the division has to be done repeatedly on the quotient of the previous division until the remainder is '0' and collect all the 'remainders'. Form a number from the remainders, in the reverse order....and....VOILA!

Example: (Converting '19' (decimal) to 'base 5')

19/5 = 3 ------> 4 (remainder)

3/5 = 0 - -----> 3 (remainder)

So, the decimal number 19 is equal to 34 in 'base 5'. Simple! :-)

Then I uploaded the output files and found the solution to be 'Correct'.

Here's the code for my solution:

Problem

-------

The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.

Input

-----

The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as

alien_number source_language target_language

Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

Output

------

For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.

Limits

------

1 ≤ N ≤ 100.

Small dataset

-------------

1 ≤ num digits in alien_number ≤ 4,

2 ≤ num digits in source_language ≤ 16,

2 ≤ num digits in target_language ≤ 16.

Large dataset

-------------

1 ≤ alien_number (in decimal) ≤ 1000000000,

2 ≤ num digits in source_language ≤ 94,

2 ≤ num digits in target_language ≤ 94.

Sample Input

------------

4

9 0123456789 oF8

Foo oF8 0123456789

13 0123456789abcdef 01

CODE O!CDE? A?JM!.

Sample Output

-------------

Case #1: Foo

Case #2: 9

Case #3: 10011

Case #4: JAM!

There are a couple of ways you can code a solution for this, but if you know (or did some research on) number systems, you can figure out the easiest solution.

My Solution:

------------

Since the 'decimal system' is the easiest that we humans and the programming languages (Higher-Level Languages) can comprehend, I converted the 'Alien Number' (using 'Source Language' input) into a decimal number and then divided that number with the 'base of the 'Target Language' number system) . The remainder is found and if its not zero, the division has to be done repeatedly on the quotient of the previous division until the remainder is '0' and collect all the 'remainders'. Form a number from the remainders, in the reverse order....and....VOILA!

Example: (Converting '19' (decimal) to 'base 5')

19/5 = 3 ------> 4 (remainder)

3/5 = 0 - -----> 3 (remainder)

So, the decimal number 19 is equal to 34 in 'base 5'. Simple! :-)

Then I uploaded the output files and found the solution to be 'Correct'.

Here's the code for my solution:

### English To 'Pig Latin'

Yesterday, I was doing some research about 'Latin' and 'Roman Civilization' and as I was scouring the internet, I stumbled upon this slang (or 'Backslang') called 'Pig Latin', which is also a 'English Language Game'. Following are the rules to translate a 'English' word into 'Pig Latin':

1) For words that begin with 'consonant' sounds, move the initial consonant or consonant cluster to the end of the word and add "ay."

Ex: English: Zeitgeist ------ Pig Latin: eitgeistzay

2) For words that begin with vowel sounds (including silent consonants), simply add the syllable "ay" to the end of the word.

Ex: Englsih: Algorithm ------ Pig Latin: Algorithmway

This is the basic stuff for 'Pig Latin'. If you wanna know more about this, you can fire a Google query and do some research. Also, I'm not covering much of 'silent consonants' stuff in this post.

Ok..I thought its pretty simple and wrote a basic 'Java' program to translate an 'English phrase' into 'Pig Latin'. This is a pretty basic 'Java' program tested with just a couple of test cases. And ofcourse, there are a lot of other things to be added, in order to make it a perfect translator. I'm just posting the 'Java' code that I wrote in a couple of minutes, outta my own interest. Here's the code:

The above code reads/takes 'English' phrase as input from the console and outputs a 'Pig Latin' phrase as output.

Example Input: She sells sea shells by the sea shore

Output: eShay ellssay easay ellsshay byay ethay easay oreshay

Also, the above code doesn't take care of special characters. If you want, you can customize that, accordingly. Here's an input phrase, which shows that:

Input: A skunk sat on a stump and thunk the stump stunk, but the stump thunk the skunk stunk.

Output: Aay unkskay atsay onway away umpstay andway unkthay ethay umpstay unk,stay utbay ethay umpstay unkthay ethay unkskay unk.stay

One more interesting thing is that, Google also offers its search in 'Pig Latin'. I used the link and searched using a set of keywords and found that this 'Pig Latin' search gives priority to 'Pig Latin' stuff only if you search in 'Pig Latin'. Otherwise, it is just the usual way of 'Googling'. I dont know if they cover all the cases, but here's the link:

Google Igpay Atinlay (Pig Latin)

1) For words that begin with 'consonant' sounds, move the initial consonant or consonant cluster to the end of the word and add "ay."

Ex: English: Zeitgeist ------ Pig Latin: eitgeistzay

2) For words that begin with vowel sounds (including silent consonants), simply add the syllable "ay" to the end of the word.

Ex: Englsih: Algorithm ------ Pig Latin: Algorithmway

This is the basic stuff for 'Pig Latin'. If you wanna know more about this, you can fire a Google query and do some research. Also, I'm not covering much of 'silent consonants' stuff in this post.

Ok..I thought its pretty simple and wrote a basic 'Java' program to translate an 'English phrase' into 'Pig Latin'. This is a pretty basic 'Java' program tested with just a couple of test cases. And ofcourse, there are a lot of other things to be added, in order to make it a perfect translator. I'm just posting the 'Java' code that I wrote in a couple of minutes, outta my own interest. Here's the code:

import java.util.Scanner; public class EnglishToPigLatinTranslator { public static void main(String[] args) { System.out.println("Enter The English Phrase To Be " + "Translated Into 'Pig Latin' : "); Scanner scanner = new Scanner(System.in); String strEngPhrase = scanner.nextLine(); if(strEngPhrase != null && !strEngPhrase.equals("")) { System.out.println("\nPig Latin Text : \n" + convertEnglishToPigLatin(strEnglishPhrase)); } else { System.out.println("No Input Specified!"); } } public static String convertEnglishToPigLatin(String strEnglishPhrase) { String strVowels = "aeiou"; String[] strTokens = strEnglishPhrase.split("[ ]"); StringBuffer sbPigLatinStuff = new StringBuffer(); for(int i=0;i<strTokens.length;i++) { if(strVowels.indexOf(strTokens[i].charAt(0)) >= 0) { sbPigLatinStuff.append(strTokens[i] + "way "); } else if((strTokens[i].indexOf("a") < 0) && (strTokens[i].indexOf("e") < 0) && (strTokens[i].indexOf("i") < 0) && (strTokens[i].indexOf("o") < 0) && (strTokens[i].indexOf("u") < 0)) { sbPigLatinStuff.append(strTokens[i] + "ay "); } else { for(int j=1;j<strTokens[i].length();j++) { if(strVowels.indexOf(strTokens[i].charAt(j)) >= 0) { sbPigLatinStuff.append(strTokens[i].substring(j) + strTokens[i].substring(0,j) + "ay "); break; } } } } return sbPigLatinStuff.toString(); } }

The above code reads/takes 'English' phrase as input from the console and outputs a 'Pig Latin' phrase as output.

Example Input: She sells sea shells by the sea shore

Output: eShay ellssay easay ellsshay byay ethay easay oreshay

Also, the above code doesn't take care of special characters. If you want, you can customize that, accordingly. Here's an input phrase, which shows that:

Input: A skunk sat on a stump and thunk the stump stunk, but the stump thunk the skunk stunk.

Output: Aay unkskay atsay onway away umpstay andway unkthay ethay umpstay unk,stay utbay ethay umpstay unkthay ethay unkskay unk.stay

One more interesting thing is that, Google also offers its search in 'Pig Latin'. I used the link and searched using a set of keywords and found that this 'Pig Latin' search gives priority to 'Pig Latin' stuff only if you search in 'Pig Latin'. Otherwise, it is just the usual way of 'Googling'. I dont know if they cover all the cases, but here's the link:

Google Igpay Atinlay (Pig Latin)

### Playing With Googol

Sample program, which shows how to deal with large numbers like Googol:

Here's the output of this program:

Here's the output of this program:

**Googol1 : 9223372036854775807**

Max Value of Long : 9223372036854775807

Googol2 : 1.0E+100

Googol Multiplied By PI : 3.1415926535897930E+100Max Value of Long : 9223372036854775807

Googol2 : 1.0E+100

Googol Multiplied By PI : 3.1415926535897930E+100

### Google Billboard Puzzle

In July 2004, Google tried a innovative way of recruiting talented people, by posting a mathematical puzzle on a billboard on 'Highway 101' in the heart of silicon valley. The billboard read:

The answer, 7427466391.com, would lead to a Web page with yet another equation to solve, with still no sign of the firm that wanted to recruit some of the best math guys, out there. It wasn't known that it was Google, until the puzzle was cracked.

Here's a pic of that billbaord:

I got to know this puzzle much later and thought of giving it a try. Without thinking much, my first idea was to use a simple, naive, brute-force approach of calculating Euler's Number (e) to around 10000 digits and then loop over the decimal part of 'e', taking 10 digits in each step and incrementing by 1 digit, in each step. I tried it and it worked, without consuming much time.

"Euler's Number" can be calculated in a couple of ways, but I used the following formula:

With the above formula, we can calculate 'e' by looping through, finding factorial and adding up 1/Facorial(n), in each and every loop. Java was my programming language of choice, but calculating e to 10000 digits precision is a problem because you cant use the normal primitives like "double", "float" or whatever to contain the huge number of digits in the decimal part of a number. So, it was pretty obvious that I had to use 'BigDecimal'.

One more tricky part was to determine 'how many times should the program loop through , for the precision to be around 10000 digits'? I tried a couple of combinations and found that "100" would be good enough. Also it doesn't consume much time. If you try it for 10000 or more, it would probably take a couple of minutes or hours.

Ok....I looped through "100" times in the code, calculated 'e' to a bit more than 10000 digits, in the first step. The next step, I looped through the decimal part of 'e', taking 10 char substrings (starting from the decimal point) in each step and checking whether its a prime or not. If it's a prime, the Puzzle is solved!

Here's the Java code for finding the 'First 10 digit prime number in the consecutive digits of e':

I ran this program and got the following output:

So, thats the answer and the domain address would be

....and here's the "Euler's Number (e)" that I calculated using the above approach: 'e to 10000 digits'

**{first 10-digit prime found in consecutive digits e}.com."**The answer, 7427466391.com, would lead to a Web page with yet another equation to solve, with still no sign of the firm that wanted to recruit some of the best math guys, out there. It wasn't known that it was Google, until the puzzle was cracked.

Here's a pic of that billbaord:

I got to know this puzzle much later and thought of giving it a try. Without thinking much, my first idea was to use a simple, naive, brute-force approach of calculating Euler's Number (e) to around 10000 digits and then loop over the decimal part of 'e', taking 10 digits in each step and incrementing by 1 digit, in each step. I tried it and it worked, without consuming much time.

"Euler's Number" can be calculated in a couple of ways, but I used the following formula:

With the above formula, we can calculate 'e' by looping through, finding factorial and adding up 1/Facorial(n), in each and every loop. Java was my programming language of choice, but calculating e to 10000 digits precision is a problem because you cant use the normal primitives like "double", "float" or whatever to contain the huge number of digits in the decimal part of a number. So, it was pretty obvious that I had to use 'BigDecimal'.

One more tricky part was to determine 'how many times should the program loop through , for the precision to be around 10000 digits'? I tried a couple of combinations and found that "100" would be good enough. Also it doesn't consume much time. If you try it for 10000 or more, it would probably take a couple of minutes or hours.

Ok....I looped through "100" times in the code, calculated 'e' to a bit more than 10000 digits, in the first step. The next step, I looped through the decimal part of 'e', taking 10 char substrings (starting from the decimal point) in each step and checking whether its a prime or not. If it's a prime, the Puzzle is solved!

Here's the Java code for finding the 'First 10 digit prime number in the consecutive digits of e':

I ran this program and got the following output:

**First 10 digit prime number in the decimal part of e : 7427466391**So, thats the answer and the domain address would be

**7427466391.com**" (which is defunct now).....and here's the "Euler's Number (e)" that I calculated using the above approach: 'e to 10000 digits'

PS: The above solution is a very basic, brute-force/trial-and-error approach that I used, but it very much solves the puzzle.

PS: The above solution is a very basic, brute-force/trial-and-error approach that I used, but it very much solves the puzzle.

Subscribe to:
Posts (Atom)