eListas Logo
   The Most Complete Mailing Lists, Groups and Newsletters System on the Net

 How to solve the Google Billboard trick

BEFORE ANYTHING ELSE, we'd like to say that we don't like being spoilers of anything. In fact, we hate spoilers. We ourselves worked out our way to solve this problem, and after finding the solution, the next day we did a search in Google for the funny 7427466391 number, and realized there had been a spoiler in some blog I don't even want to remember its name, hours before we submitted our response to Google (no, we did not send our resume, just the fact we've came up with the solution :-)... But obviously, the moment there's one site with the answer posted out there, anything else that comes after that is just useless... The only reason we're posting this here now is because there's a spoiler out there already. Otherwise you wouldn't be seeing this here. We respect Google and hope they come up with more fun and interesting challenges and puzzles like this one, whether it's to recruit people or just for the fun of it, and we'll never post a spoiler unless some smartie had done it already somewhere else.

Having said that, let's get to work...First of all you probably know by now that the {first 10-digit prime found in consecutive digits of e}.com resolves to 7427466391. However chances are you found out that by looking at it at some web site.

But assuming you have no Internet, this is the first data you need to obtain. Certainly I wouldn't suggest doing this by hand, so, how could you do it?

Before we get our hands dirty, let me say that you can really do this with a lot of different languages/compilers and what not. Some may want to use Python (one of the easiest languages one can write), or Mathematica (that's what it's for), but here we'd decided to go with C, well, don't really ask me why, we're that obtuse! ;-) In any case, if you can read C, I'm sure that porting this to your favorite language will be piece of cake.

So since we're going to use C, we'll assume you have a standard C compiler on a 32 bit machine.

First, you need to write some program to output enough digits of e so that you'll find an answer. This little program will do the trick:

main() {
   int i,x,n;
   int a[9009];



   for(;i>9;) {
      for(n=i--;--n;) {

Compile and run this program and you'll get enough digits in e for solving this problem. In fact, you'll get a whole lot more digits than what you'd need, so save it as it may come handy for future challenges :-)

Now, you need some function to identify if a number is prime or not. This can be really tricky for very large numbers, but well, we're dealing with a 10 digit number, that's large but not too big, right? :-)

And because we're assuming we're working with a 32 bit machine, we'd better make sure we use the right numeric type (that'll be "long long" by the way). This function can determine whether a number is prime or not with enough accuracy for our purpose here:

long isPrime(long long thisNumber) {
    long pMaxSeek,a,primeFound;



    for(a=3;a<=pMaxSeek;a++,a++) {
        if(!(thisNumber%a)) {

Simple, huh?

So with enough digits from e and a function to identify whether a number is prime or not, it'd be really trivial to find out what's the first 10-digit prime found in consecutive digits of e. Do we need to write the code for you? Probably not, but here goes one out of a million ways it can be done ;-)

#include <stdio.h>
#include <strlen.h>
#include <math.h>

   Down here you put the output of the first program, with about,
   say, 2000 digits from e. You could also output these to a file
   and have this program to read from it
char *e= "...";

long long tin;
long isPrime(long long p);

main() {
    int i,len;

    for(i=1;i<len;i++) {
	    /* ok this may look lame, there are many ways to do it,
		   but this way it's easier to read and understand,
		   we're not trying to be fancy here */
        tin = (long long)
        (e[i]-'0')   * 1000000000 +
        (e[i+1]-'0') * 100000000 +
        (e[i+2]-'0') * 10000000 +
        (e[i+3]-'0') * 1000000 +
        (e[i+4]-'0') * 100000 +
        (e[i+5]-'0') * 10000 +
        (e[i+6]-'0') * 1000 +
        (e[i+7]-'0') * 100 +
        (e[i+8]-'0') * 10 +
        if(isPrime(tin)) {
             printf("First prime (pos.%d): %lld\n", i, tin);

/* INSERT HERE the isPrime function from above */

(now the Python people must be having a ball, hey, that's why you switched to Python in the first place, right? :-)

Anyways, compile it, run it, and voila! There it goes your 7427466391.com

So now we are where you already knew you were :-)

Now for the second part of the problem:

f(1)= 7182818284
f(2)= 8182845904
f(3)= 8747135266
f(4)= 7427466391
f(5)= __________

The first three numbers certainly have something in common. If you look at the sequence of digits in e, the first falls in the ordinal position 1, the second in position 5, and the third in position 23. These all are prime numbers. There are other interesting things one can deduce from this sequence, but the truth is, they don't matter much in the end, so we'll spare you the details.

From here, it really gets tricky. A lot of different things could make sense. However, the f(4) really seems to be out of place. It falls under position 99 which is not a prime. What the...?

And here's the trick! Really, because the first three numbers can lead to several different logic explanations, one needs to find what all these four numbers have in common... And the only thing they seem to have in common is... the digits of each number added individually, sum 49.

So one could guess.. Should we find the next 10 digit sequence in e whose digits added individually total 49? Well, yes but not so fast. Because the 4th number is the answer to the previous question, we should think that the first three numbers are telling us something else besides their digits add to 49. And we do know that something else: that they all fall in prime positions!

So, why don't we write a little program that finds 10-digit sequences from e , whose individual digits add to 49, and whose ordinal position falls on a prime number?

Fair enough:

#include <stdio.h>

   The first prime numbers, easy enough, let's just enter them
   here directly, why not
int prime[] = {
	9999 /* just to detect when we're done */

    Again, put here the output of the first program, 
    with 2000 digits from e or so, or whatever way you'd
    like to do this....
char *e= "....";

main() {
    double z;
    int zi,s,i;

    for(i=1;prime[i]<999;i++) {
       s = prime[i];

       /* Again, do this thing below any way you want it */
       zi = (e[s]-'0')   + (e[s+1]-'0') + (e[s+2]-'0') + (e[s+3]-'0')+
            (e[s+4]-'0') + (e[s+5]-'0') + (e[s+6]-'0') + (e[s+7]-'0')+
            (e[s+8]-'0') + (e[s+9]-'0');

        if(zi==49) {
            /* And again, you can get fancy here to get the output
               of the 10 digit sequences, but this will do */
            printf("Value %d (%d) = %c%c%c%c%c%c%c%c%c%c\n",
                e[s],  e[s+1],e[s+2],e[s+3],e[s+4],


Once again, Python programmers must be having a really good time :-) But regardless, compile this, run it, and this is the output you get:

Value 1 (1) = 7182818284
Value 4 (5) = 8182845904
Value 10 (23) = 8747135266
Value 32 (127) = 5966290435

Our friends from f(1), f(2) and f(3) show up happily at the beginning. Well, maybe we should try our luck with the next value, don't you think so?

And that's it. It wasn't that hard, was it?

Services:  List Hosting ServicesProductsIndustry Solutions
Your Account:  Sign UpMy ListsMy PreferencesOnline Help
General:  About UsNewsPrivacy PolicyNo spamContact Us

eListas Seal
eListas is a registered trademark of eListas Networks S.L.
Copyright © 1999-2005 AR Networks, All Rights Reserved
Terms of Service