What are some great advertisements? by Vinay Mittal

Answer by Vinay Mittal:

Google Billboard Puzzle

This is one of the best advertisement cum classified I have ever came across…

In 2004, google came with a brilliant way of recruiting talented people.

They posted a mathematical puzzle on a billboard on 'Highway 101'

in Silicon Valley It read:

**{first 10-digit prime found in consecutive digits e}.com."**

The answer, http://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. It looked somewhat like

well, in this manner they created a buzz around the valley, resulting into mouth publicity. This was the era when silicon valley was following an ever rising trend and fighting for smart employees.

Thus by posting this, they already shortlisted thousands of applications by placing the ad among the eligible candidates only.

Now if you’re done with brainstorming here's the code for finding the 'First 10 digit prime number in the consecutive digits of e'

import java.math.BigDecimal;
import java.math.MathContext;
public class EulersNumber {
public static void main(String[] args) {
BigDecimal e = BigDecimal.ONE;
BigDecimal bigDecimal = BigDecimal.ONE;
for(int i=1;i<100;i++) {
bigDecimal = bigDecimal.multiply(new BigDecimal(i * 1.0 + ""));
e = e.add(new BigDecimal(1.0 + "").divide(bigDecimal, new MathContext(10000)));
}
String strDecimalPart = (e + "").substring(2);
for(int i=0;i<strDecimalPart.length()-10;i++) {
long num = Long.parseLong(strDecimalPart.substring(i,i+10));
if(isPrime(num)) {
System.out.println("First 10 digit prime number in the decimal part of e : " + num);
break;
}
}
}
public static boolean isPrime (long n) {
if (n<=1) return false;
if (n==2) return true;
if (n%2==0) return false;
long m = (long) Math.sqrt(n);
for (long i=3; i<=m; i+=2)
if (n%i==0)
return false;
return true;
}
}

**Edits 1 : Whoa! 1K-Upvotes, first ever for me, tons of thanks to each one of you…**

What are some great advertisements?

### Like this:

Like Loading...

*Related*