Fog Creek Software
Discussion Board




Myserious billboard

Driving to work in Silicon Valley, I saw a billboard that said:

{ First 10 digit prime in consecutive digits of e }.com

So after writing a little python script to calculate this, I got to:

http://www.7427466391.com

Check out that site and see what it says.  I can't figure out what f(5) is.  f(4) is the number we just found, and f(1), f(2), f(3) are all 10 consecutive digits of e.

Their indexes are 1, 5, 23, 99 within e, or maybe 0, 4, 22, 98 depending on how you count.

So what comes after that?  I looked up here:

http://www.research.att.com/~njas/sequences/

There is an entry with 401 as the next number, but it is quite obscure.  Not something you would come up with unless you knew about this site (which most people probably don't).  Can't see any other pattern in those numbers.

So trying e[401..411] as the password did not work, as well as some others.

I am in crunch mode on my project and don't want to spend too much time on this!  Spent about a half hour trying to figure out #2.

What a clever marketing ploy!  But it is for Linux?  (see web page)  Are they trying to attract good programmers?  Maybe it is a hiring thing?  What do you guys think?

Help me figure it out!

Roose
Friday, July 09, 2004

NOTE: This was from a huge billboard on 101!  These people must have money!

Roose
Friday, July 09, 2004

They are 10 digit sequences of e whose digits add to 49.  I don't have a handy way to find the next, so I'll punt.

Brian
Friday, July 09, 2004

Its an alien plot.

Simon Lucy
Friday, July 09, 2004

Billboards are cheaper than you think.

I'd read about companies doing this as a recruiting technique. I believe it was here in this forum. Maybe you or someone can dig up a link. You should follow through, maybe you can get a good job at a good company.

www.MarkTAW.com
Friday, July 09, 2004

Thanks Brian, duh.

Oh well, it ended after step 2.  That pretty much gives it away (the 49 thing) -- it was indeed a hiring plot, but not for Linux, interestingly.

As I thought, the purpose was to find good programmers or problem solvers.

Python is a wonderful little tool (along with Google to find the digits of e).  As a side note, anyone who is a programmer who is curious about this and finds it a total chore to do in your favorite programming language (e.g. C, C++, Java) really needs to have something like Python under their belt.  I probably wouldn't have even tried without it... too much typing (seriously).  The interactivity and brief syntax of python is great.

Roose
Friday, July 09, 2004

http://www.whois.sc/7427466391.com

Most of the whois stuff is garbage & won't tell you anything about the company, but check out this line:

IP Location: - California - Mountain View - Google Inc

www.MarkTAW.com
Friday, July 09, 2004

Spoiler:

The answer is:

5966290435

Jan Derk
Friday, July 09, 2004

On second thought, that was a childish post of mine. Where is the post delete button when you need one.

Jan Derk
Friday, July 09, 2004

That is a pretty cool tactic by google.

For anyone who hasn't cheated like I did (ie used the information in this post to find out the *secret*), basically the last page is just Google asking you to submit you resume to them.

Their idea (SPOILER I GUESS) being that if you were curious and smart enough to get that far then they would like to see your resume. At least for a while the resumes that flow through to that email address will be generally of a higher calibre (hopefully), as they put it, they are hoping to increase the signal to noise ratio.

I like that idea. It reminds me of the movie starring Woopi Goldberg as a NY nicks fan, she used to leave a question on her answering machine that had to be correctly answered before she would listen to the message.

Aussie Chick
Friday, July 09, 2004

lengthy java code?  seems simple to me...

public class CalcE {
public static void main(String[] args) {
  int i = 0;
  String e = /*<insert string def. of 'e' here>*/;
  System.out.println(GetNext49(e, i));
  System.out.println(GetNext49(e, 3));
  System.out.println(GetNext49(e, 7));  // OK - I cheated a bit - forgot my java syntax
  System.out.println(GetNext49(e, 25));
  System.out.println(GetNext49(e, 101));
}

static String GetNext49(String in_Str, int i) {
  int j = 0;
  String tStr = in_Str.substring(i);
  while(combine(tStr.substring(j, j+10)) == false) {
  j++;
  }
  i = j;
  return tStr.substring(j, j+10);
}

static boolean combine(String in_Str) {
  int i = 0, c = 0;
  for(c = 0; c < 10; c++) {
  i += (int)(in_Str.charAt(c) - 48);
  }
  if(i == 49)
  return true;
  return false;
}
}

btt
Friday, July 09, 2004

"Python is a wonderful little tool (along with Google to find the digits of e).  As a side note, anyone who is a programmer who is curious about this and finds it a total chore to do in your favorite programming language (e.g. C, C++, Java) really needs to have something like Python under their belt.  I probably wouldn't have even tried without it... too much typing (seriously).  The interactivity and brief syntax of python is great."

I'm a Ruby man myself, and I know what you mean. The great thing about Perl/Python/Ruby is that they allow you to quickly write your algorithm in very few lines of code without having to wrap it up in a lot of boilerplate. I highly recommend learning one of these three languages if you haven't already.

Karl
Friday, July 09, 2004

another language that's great for just finding the answer to math probs is good ol' QBasic. 

sir_flexalot
Friday, July 09, 2004

Their email address doesn't seem to be working. I guess too many people have sent them messages, unless my ISP has gone bad again.

Steve Jones (UK)
Friday, July 09, 2004

JavaScript's quite nice for the purpose thanks to its anonymous functions. I've done a lot of JavaScript and hence tend to fall back on it, though I plan to learn Python at some point.

The code:

var e = "27182818284"; // [snipped - a few hundred digits copied from the web]


function reduce(f, list) {
    var sum = 0;
    for (var i = 0; i < list.length; i++) {
        sum += f(list[i]);
    }
    return sum;
}

for (var i = 0; i < e.length - 9; i++) {
    var number = e.substr(i, 10);
    var digits = number.split("");
    if (reduce(function(x) { return parseInt(x); }, digits) == 49) {
        document.write(number + "<br />");
    }
}

Tim Down
Friday, July 09, 2004

Since we had that plug for Python a few posts ago, which was countered by someone posting Java code, is there any chance someone (the OP, maybe?) could post the equivalent Python code?  It'd be neat to see.


Friday, July 09, 2004

Excuse me for being ignorant, but how does one know what 'e' is?  I assume it's some constant or theoretical number of some sort, but I haven't the mathematical background to be sure.

muppet from madebymonkeys.net
Friday, July 09, 2004

We're being watched: http://news.zdnet.co.uk/business/employment/0,39020648,39160024,00.htm

Mike Schiraldi
Friday, July 09, 2004

I think that's scary (the news article on the blogging)

Elephant
Friday, July 09, 2004

That is a bit creepy.  Alright Rupert, the least you could do is fess up.

Steve Barbour
Friday, July 09, 2004

Soon that ZDnet article will be linked on Slashdot.

Being watched will not be as bad as being Slahdot-ed. Has JoS been Slashdot-ed before, when some of Joel's articles that may appeared there?

KayJay
Friday, July 09, 2004

Here are two days of defining e:

e is the inverse of the logarithm function, which can be defined as

log[n] = the area under the curve of the function f(x) = 1/x from 1 to n

Also, e^x = 1 + x + x^2/2! + x^3/ 3! + ...

Matt

Matt
Friday, July 09, 2004

Here's another one:

http://www.beltzner.ca/ifeelafel/archives/000466.html

a
Friday, July 09, 2004

From article,

'According to a software developers' blog hosted by New York's Fog Creek Software.....'

I did not know that JoS forums is a group blog! ;)

JD

JD ( http://jdk.phpkid.org )
Friday, July 09, 2004

It is! Have you read the posts here?

"I had a wonderful day today at work!"

"I have thrown in the towel!"

"My new job"

"My new programming language"

"I want to work for MS"

Just a few. Each by a different person, spread across 3 continents!

KayJay
Friday, July 09, 2004

The real question is: Where the heck is this billboard. I drive 101 every day and I don't recall seeing it.

Michael
Friday, July 09, 2004

>>>Excuse me for being ignorant, but how does one know what 'e' is? <<<

Yes, e is a mathematical constant.  It is the base of natural logarithms, almost as significant as pi in terms of how useful it is.  Usually taught in a first, high school level, calculus course.

If you're really interested, go to Amazon and search for the book "e: The Story of a Number".

I've read Google's job ads.  The people they're looking for would know about it.

mackinac
Friday, July 09, 2004

It's all true - I was alerted to this by a developer friend (hi, Peter!) and we went 'Ooooh! That's fun!'

So apologies for creeping you out. But anything involving natural logarithms and roadside advertising is too good to pass up. No sign of Slashdot taking an interest, though.

Rupert Goodwins, technology editor, ZDNet UK

Rupert Goodwins
Friday, July 09, 2004

Roose,

Can you tell location of billboard to Michael so that he can verify that indeed a billboard is there! Just kidding! ;)


JD
http://jdk.phpkid.org

JD ( http://jdk.phpkid.org )
Friday, July 09, 2004

Ruperts not here, it was me. I occasionally tip him off to stuff that hasn't hit the mainstream. Sometimes its fun to watch an idea be spread around the world. I usually get the odd drink for my troubles (We live around a mile or so apart, so he'll sometimes stop off for a drink on his way home)
Note as a journalist he's usually fairly hot on the technology as he was programming 386 networking OSs when I first met him twenty odd years ago (he even found an obscure bug IIRC "pop ax" affected the high bits of the eax register). Once upon a time he worked for sinclair on the spectrum ROMs.

Peter Ibbotson
Friday, July 09, 2004

And to throw in a useful link:  Wolfram/Mathematica maintains a web site with brief descriptions of various mathematical concepts.  Just go to http://mathworld.wolfram.com  and enter e in the search box.

mackinac
Friday, July 09, 2004

The spurious trailing non-printing character corrupts another URL.  Try this one:
http://mathworld.wolfram.com/e.html

mackinac
Friday, July 09, 2004

Mackinac:  I was in some seriously advanced honors level physics and chemistry courses in HS and never once heard of 'e'.  Or if I did, I certainly don't remember.

Of course, IANAM (I am Not a Mathematician)

muppet from madebymonkeys.net
Friday, July 09, 2004

In related news, here's a fun way to remember e.  It's all about Andrew Jackson, who served two terms as President of the United States.

He served two terms:
2.
He was the seventh president:
7
He was elected in 1828 (and served two terms)
18281828
Finally, if we had a square picture of Andrew Jackson and drew a diagonal line from corner to corner, we'd have a 45-90-45 triangle:
459045
Then, e to sixteen digits is
2.718281828459045


Friday, July 09, 2004

==> I was in some seriously advanced honors level physics and chemistry courses in HS and never once heard of 'e'.

Then you were hoodwinked and I suspect that your classes were not as "seriously advanced" as you were lead to believe.

I first ran into 'e' in first year HS algebra (with a very superficial treatment). Later (senior year) in Calculus had a very thorough treatment of the subject, and again (senior year) in Physics class practical application of the concept was clearly demonstrated. I took no "honors classes" in mathematics or physics -- my exposure to 'e' was through the normal curriculum.

Sgt. Sausage
Friday, July 09, 2004

>>> I was in some seriously advanced honors level physics and chemistry courses in HS and never once heard of 'e'. <<<

OK.  Interesting.  It has been a really long time since I was in HS.  Once you get to integrals in calculus you can't avoid it. Maybe they can teach HS level science without calculus.

mackinac
Friday, July 09, 2004

There was calculus, but no 'e'.

It's been many, many, MANY years, and my memory isn't so good, so perhaps I'm wrong.

Or maybe 'e' was just something rolled up into the formulae and never explained on its own.

muppet from madebymonkeys.net
Friday, July 09, 2004

"Or if I did, I certainly don't remember."

I'm pretty sure this is the case.  It's simply not possible to be in an advanced science class and not be exposed to e.

Aaron F Stanton
Friday, July 09, 2004

> http://www.beltzner.ca/ifeelafel/archives/000466.html

THAT was the other one I was thinking of. Thanks.

Say, I figured out it was Google and a major news source caught on. Through them, the final page in the easter egg hunt was posted for the world to see. So while I didn't solve the problem, my ingenuity did lead to the final page.

I can't calculate the e of anything, but it could be worth a job. Maybe I should email them.

Of course, my answer would probably be: "We hate you, you spoiled our little game for us way ahead of time. Next time we post a billboard it translate to 'Mark is a big fat idiot.' "

www.MarkTAW.com
Friday, July 09, 2004

http://www.google.com/labjobs/index.html

Miguel
Friday, July 09, 2004

Man I admit I was a little lazy in posting the first step for Brian to figure out, but you guys don't have to TOTALLY spoil it (even though I sort of spoiled it).  Now they know their recruitment tactic is screwed.  The answer was already there -- you didn't have to post the direct link for everyone to see.

Man I can't believe ZDNet picked up on that already and even quoted me!

I just posted the first post last night at 1:00am!  It is 10:37am now.

Re: Python, Java, etc.

The point is not that you can write that Java code in a short time/few lines.  The point is that there is no way that is the ONLY code you would write to figure out the problem.  There is some exploring going on here.

Of course any language is fine if you already KNOW what you're going to write.  But languages like Python and others are better when you just need to try stuff out, when the objective isn't known... you don't have to bog yourself down in any overhead, you just write what you mean and you don't have to think about it.

Obviously I'm not saying Python is better than Java or whatever, it is just something to have under your toolbelt.

BTW, the billboard is on the Ralston Ave exit going south coming from San Francisco.  Trying to recruit some Redwood Shores people -- EA and Oracle?  (I work for EA, funny that the other instance of this technical advertising is from EA, but not really as clever).

Roose
Friday, July 09, 2004

I dunno, EA thought of it first, that has to have some cleverness brownie points.

www.MarkTAW.com
Friday, July 09, 2004

"We're being watched"

Now that I think more about it, I want Rupert's job. "No, surfing forums is job related. Look at my last story."

www.MarkTAW.com
Friday, July 09, 2004

Agree with MarkTaw, I want Rupert's job where I can 'officially' surf the web and get paid! ;)

JD

JD
Friday, July 09, 2004

What I want to know is if this came from their PR or HR department.

www.MarkTAW.com
Friday, July 09, 2004

One-line solution in Mathematica:

Select[Partition[Rest@RealDigits[e,10,150][[1]], 10,1], Plus@@#==49&]

free(malloc(-1))
Friday, July 09, 2004

> It's all about Andrew Jackson, who served two terms as
> President of the United States.
[cool mnemonic for e deleted]

For a math nerd like me, that's a pretty cool way of remembering when Andrew Jackson was elected!

Michael Eisenberg
Friday, July 09, 2004

> Finally, if we had a square picture of Andrew Jackson and drew a diagonal line from corner to corner, we'd have a 45-90-45 triangle:

I have a square picture of Britney Spears, will that do?

Alex
Friday, July 09, 2004

"We're being watched"

Wow. I mean really. This thread is only a few hours old and already the mainstream media is writing actual news articles about this thread?

They must really monitor JoS pretty tightly. I guess we do see a lot of fresh news first here though.

<<shudder>> I have a feeling this may portent the end of this board being a well kept secret.

Dennis Atkins
Friday, July 09, 2004

> I was in some seriously advanced honors level physics and chemistry courses in HS and never once heard of 'e'.

That's very sad to hear.

Unforunate further proof that education in this country has gone all to hell.

Dennis Atkins
Friday, July 09, 2004

Is there a number theorist in the house? ;) There's something interesting about f(1), f(4) and f(5), but I'm wondering if there's any nice fact about the other two.

Well, I don't know if f(5) is so interesting, but its position in e is nice, whether you start counting at 0 or 1.

f(1)+..f(4) add up to something vaguely looking like pi's digits... I should make some program do various tests and leave it on all night, so if ITA Software ever asks a similar question... ;)

Tayssir John Gabbour
Friday, July 09, 2004

I wonder how many resumes that "problem solver" eMail address is going to get from people who didn't actually solve the problem?

www.ChristopherHawkins.com
Friday, July 09, 2004

Journalism sure is easy these days.  That ZDNet article makes me think of a scathing Christian Science Monitor article on the number of journalists who judge a subject's or person's importance by the number of Google hits it/he/she gets:

http://www.csmonitor.com/2004/0227/p09s01-coop.html

muppet, you should learn more about e.  It's fun:

Take 1.  Add 1.  (2)
Take the reciprocal.  (1/2)
Add 1.  (3/2)
Take the reciprocal, add 1.  (5/3)
Take the reciprocal, add 1.  (8/5)
Take the reciprocal, add 1.  (13/8)
Repeat ad infinitum, and you've got e.

Or to make it easier, just take n / (n-1), where n is the highest value you can find in the Fibonacci sequence.  (1, 1, 2, 3, 5, 8, 13, 21, etc.)

Kyralessa
Friday, July 09, 2004

n/ (n-1) approaches 1 not e as n increases.

Dennis Atkins
Friday, July 09, 2004

The sequence you posted is for the golden ratio, not e.

Dennis Atkins
Friday, July 09, 2004

As an aside, there are two kinds of high-school physics courses:  calc-based and algebra based.  In the algebra based ones, you are handed all the formulas and told to memorize them, as opposed to using calculus to derive them yourself.

Therefore, it's quite conceivable that one could learn a lot of basic physics without having ever heard of 'e,' and without it predicting the demise of the American education system :)  However I wouldn't classify anything in this realm as "super advanced."

Joe
Friday, July 09, 2004

Yeah I know - there's the physics for art majors, and then there's the real physics classes. Real physics have calculus as a prerequisite and not calculus for economics majors, but real calculus with delta-epsilon proofs through multivariable calculus and differential equations.

The poster had described his course as "seriously advanced honors level physics and chemistry courses", which I take to mean a class intended to work as college credit through an AP test. I would hope that such a course would be real physics and not fake physics. But we have the teachers running in terror of having their students or themselves tested in the No Child Left Behind program. The reason is obvious - it shows which students are doing poorly and which teachers and schools are so entrenched in bureaucracy that they accomplish nothing but babysitting. We have teachers demanding and getting lifetime tenure after 2 years of teaching kindergarten. In such a system, many dishonest schools and teachers will try to label a crap class as AP or Honors in order to fool the parents and students into thinking their education is worth the insane prices in taxes that are being charged and the ridiculous salaries going to incompetant morons with so-called teaching credentials.

Dennis Atkins
Friday, July 09, 2004

No Child Left Behind wasn't even a twinkle in Dubya's eye when I went to High School.

muppet from forums.madebymonkeys.net
Friday, July 09, 2004

and since I managed a 1500 SAT, and was accepted into some top 3% schools (though I didn't attend), I'd say my education was more than adequate, but thanks for implying that I'm a moron.

muppet from forums.madebymonkeys.net
Friday, July 09, 2004

I don't think Dennis was implying that muppet is a moron.  He was saying the educational system is seriously hosed, and he's right about that.  The only thing that will fix it is more taxes, more government involvement, more unions, and less accountability.  heh heh

Speaking of Google, I can't wait for the Google IPO.  One more sucker punch to the gut of the clueless American investor before the stock market collapses in the aftermath of the world's largest credit orgy.

free(malloc(-1))
Friday, July 09, 2004

I've known about e for so long it is hard to remember a time when I didn't.  As a timewaster I decided to look through some old textbooks and see just how far one could get before needing e.

First exposure to it will probably be in integral calculus.  When you need to integrate 1/x you learn about natural logarithms and then e just falls out of that.  For me that was in high school.  I have not wanted to join the education system bashing here (not that it is undeserved), but anyone who took calculus and didn't learn about e was taking a deficient class.  You could learn quite a bit about calculus without it.  But it would not be a useful prerequisite for anything that followed.

As for physics, you could do a lot of basic mechanics with just quadratic equations and similar level of integrals and derivatives.  But once to get to something like damped harmonic motion, or anything described by a differential equation (e.g., electronic circuits) you can't avoid it.

mackinac
Friday, July 09, 2004

Re: Perl, Ruby, Python...

And don't forget PHP now that a PHP CLI version is available...

http://badblue.com/blog
Friday, July 09, 2004

http://mathforum.org/library/drmath/sets/high_logs.html

Some good introduction and pointers to its application.

KayJay
Saturday, July 10, 2004

Actually you can get through AP Physics just fine without calculus.  And AP is about as "seriously advanced" as any normal high school is gonna get.

Keep in mind, AP classes, for the most part, end up satisfying your 101 requirement and *maybe* 102.  It's not like AP Physics is going to excuse you from 2 years of class.

Of course, AP Calc is a little better...you can get 3 full college semesters out of the way with that.

Joe
Saturday, July 10, 2004

> I don't think Dennis was implying that muppet is a moron.

you are correct! Not sure why he thinks that. I think he might be very sensitive.

> He was saying the educational system is seriously hosed, and he's right about that.  The only thing that will fix it is more taxes, more government involvement, more unions, and less accountability.  heh heh

Heh heh indeed - finally someone who sees it for what it is!

> Speaking of Google, I can't wait for the Google IPO.  One more sucker punch to the gut of the clueless American investor before the stock market collapses in the aftermath of the world's largest credit orgy.

Yah man - they tech investors gonna mortgage their $1.2 M cottages in Santa Clara and $400k trailers in LA to get in on the action. And then it's all gonna go down bad for them. Planning to watch the whole thing from my lawn chair and have some people over for barbecued ribs that day!

Dennis Atkins
Saturday, July 10, 2004

Re 'e':

*the* equation.

e^(i*Pi) + 1 = 0

.
Saturday, July 10, 2004

That's not an equation but an identity. It just falls out of the fact that all three of those constants are formed by similar infinite series that all combine in that way.

Dennis Atkins
Saturday, July 10, 2004

" *the* equation "

You can't find e that way, because of i.
To "solve" the equation (check if it's 0), you'll have to work with sin and cos (which makes sense because of pi), not e.

*the* real "equation" (Taylor), for everyone who is too *lazy* to look it up via one of the links above, or in his/her old math books:

e^x = 1 + SUM( {n = 1 to infinity} (x^n) / (n!) )
[how do you format that in plain text ?]

or
e^x = 1 + x + (x^2)/2! + (x^3)/3! + (x^4)/4! + ... etc.

so
e = 2 + 1 / (2!) + 1 / (3!) + 1 / (4!) + 1 / (5!) + ... etc.

I know this is not an equation, nor a definition, but it is *the* way to find e.
The actual definition of e is this:

[e ^ x] ' = e ^x

or it can be defined as the inverse of the natural log (but actually it's the other way around - homework: why?).

Janonymous
Saturday, July 10, 2004

By '*the* equation' I meant it was beautiful,  important and fundamental. An aesthetic adjective more than a definitive article.

The equation has three constants, five if you take 0 & 1. all three dicovered/derived without a reference or even knowledge of the others in three totally different contexts. The equation contains all three additive operations, addition, multiplication and exponentiation. It encompasses Integral Calculus, Arithmetic, Trigonometry - e^(i*pi) = cosz + isinz - and Group Theory. Hence "*THE*".

KayJay
Saturday, July 10, 2004

Hey Dennis, what's the series for i?

Brent
Saturday, July 10, 2004

It's i.

Dennis Atkins
Saturday, July 10, 2004

Has someone got a picture of that billboard?

Felipe
Saturday, July 10, 2004

I solved it (prior to reading this message board) using this small perl script. "e" is a file i created by copying 500 digits of e from a website to file e and then using perl -pi -e's/(.)/\1\n/g' on the file.


open(FILE, "e");
@f = <FILE>;

for ($i=0; $i<=500; $i++) {
  for ($j=$i; $j<$i+10; $j++) {
    $sum += $f[$j-1];
  }
  print "$i: $sum\n" if $sum == 49;
  $sum = 0;
}

print "\n";
$MAGIC=127; # went back in and put this in.
for ($i=$MAGIC; $i<$MAGIC+10; $i++) {
  chomp $f[$i-1];
  $sum += $f[$i-1];
  print $f[$i-1] . "";
}
print "\nTRUE SUM: $sum\n";

Cal Bear
Saturday, July 10, 2004

The way I solved this:

1. Generate e, according to algorithm here: http://www1.physik.tu-muenchen.de/~gammel/matpack/html/Mathematics/Pi.html

2. Find the prime:

from math import sqrt

def isPrime(n):
    """Detect if a number is prime"""
    if n < 2: return False
    for i in range(int(sqrt(n)) + 1)[2:]:
        if n % i == 0: return False
    return True

f = open("e.txt")
s = f.readline()
f.close()

for i in range(len(s)):
    candidate = int(s[i:i+10])
    if isPrime(candidate):
        print candidate
        break

3. Learned from web that f(1..4) all have 49 as sum. This is probably the hardest step if I don't know that.

4. Find the 5th number in e:
f = open("e.txt")
s = f.readline()
f.close()

count = 0
for i in range(len(s)):
    subs = s[i:i+10]
    if 49 == sum([int(c) for c in subs]):
        count += 1
        print count, subs
    if count >= 5:
        break

Brian Zhou
Saturday, July 10, 2004

Brian,

That website reference with the one liner of C code for calculating e to 3302 digits is particularly awesome in the most spectacular way possible.

It kind of negates the claims about python vs c though - the code is quite simple. i doubt it would be easier to write the same code in python.

Dennis Atkins
Sunday, July 11, 2004

You can write a C 1-liner, but are they usually the natural way to write them, or do you end up compressing code after a stable verbose version?

The important issue is what you don't see. Roose argued that if you have an interactive language, you can interact with code while it's running. So you can poke and prod data structures, finding patterns. So I had a fine time using lisp to find nice patterns, summing digits, etc.

Especially with puzzles, you do a great deal of prodding stuff.

I personally pasted e into emacs, and used a quick keyboard macro to strip whitespace. Another keyboard macro parsed f(1)..f(4) into a list. Then I started looking for patterns. Unfortunately I read the 49 hint because I read this thread too late, so it made everything pretty brainless, but I was still able to check for other patterns.

Also, I took this as an opportunity to grab someone's optimized prime tester which could use Miller-Rabin's algorithm.. wrote my next version of my test framework.. and learned the loop macro, which is the hedonistic lisp iteration sublanguage.

Tayssir John Gabbour
Sunday, July 11, 2004

Jan Derk, please shot yourself in the head.

I spent about 4 hours last night working on the problem, and finally was very excited I solved it.  Then today I do a search on the funny number (yesterday you wouldn't get anything other than the news abou it, I suppose because Google hadn't indexed this blog yet) and find the spoiler...

So now of course, since some smartie just couldn't keep it for himself even for 20 minutes, the whole world knows the answer. It's not really about sending your resume (I didn't send mine but I did send them a message with the answer and the logic behind it) , but now, all the messages from the people who honestly worked out the problem get mixed up with all the losers who simply copied it from this blog.

What is it worth being able to resolve a problem if in the end you resort to childish show-off behaviour? A silly silly man behind it.

We'll see how Google figures out how to avoid things like this to happen in the future. I guess it's impossible. The world is full of mediocrity.

LB

LB
Sunday, July 11, 2004

Well LB, I hope you enjoy these puzzles... especially the last one on the page.
http://www.itasoftware.com/careers/eng/job2.php

Tayssir John Gabbour
Sunday, July 11, 2004

I know I learned about e eon's ago, but all I remember is i.
I'm totally confusing e and i.  Very embarresing, as i is a lot simpler.

Jerry Ludwig
Sunday, July 11, 2004

"We'll see how Google figures out how to avoid things like this to happen in the future. I guess it's impossible"

I wouldn't worry about them. There's this thing called IP address logging. And another called refering pages. They'll be able to sort it all out.

Dennis Atkins
Sunday, July 11, 2004

Also, that expensive billboard wasn't just to get resumes from a test. It was a brilliant marketing ploy that garnered them a lot of positive press. Now everybody who should know knows that Google is the new Bell Labs.

Dennis Atkins
Sunday, July 11, 2004

Tayssir, yes thanks for getting my point.

Most of the people who posted code didn't post the full version.  It took at least a little experimentation.  I wrote a bunch of code that was throwaway before I asked and got the 49 hint at the beginning of the thread.  A bunch of people only posted code for the second half, and at least one claimed not to have read the thread before while not addressing part 1 of the question at all.  : )

The C 1 liner does not refute anything.  It is "refined" code, not experimental code which I was talking about.  C does not flow out of the fingers like Python or other languages do.  I know because I am a full time C programmer.  If you have ever programmed C (and Python) for an extended period you wouldn't try to argue with me.

It still amuses me how people seem to think that compressing code all on one line and removing whitespace makes it more elegant?

Google's little scheme was bound to be spoiled at some point, it is just a matter of how fast.

Has anyone else seen the billboard?  Is the one I saw the only one?

Roose
Sunday, July 11, 2004

"Also, that expensive billboard wasn't just to get resumes
from a test. It was a brilliant marketing ploy that
garnered them a lot of positive press."

If you ask me, it was primarily a marketing ploy. What... Didn't Google know that sooner rather than later the whole world was going to know the answer? If they thought they could keep this a secret for a few "chosen ones" that means Google doesn't know a thing about Internet.  Not quite the message Google would like to broadcast to the world.

That's another reason why I didn't bother to send them my resume :-) But it was fun I must admit, that's why I got into it really. And I also admit that when I saw the spoiler here, I really was like "oh well, some people just have to spoil it for the rest of us"... No hard feelings.

LB
Sunday, July 11, 2004

Its sort of funny that I found the answer to both riddles/problems by going to www.google.com and searching for them!

BTW, slashdot just rejected my storry on thist, too

toetagger1
Sunday, July 11, 2004

Sometimes there's a benefit to being old -- I just used my sliderule.  ;-)

Sliderules were all about using logarithms -- all of them had base-10 logs, but most of them also had log-log scales that would do natural logs (LL3 scale).  To use a sliderule, you *had* to know logs, as that was how you did multiplication & division on one.

See:
http://dspace.dial.pipex.com/town/square/gd86/slides.htm

example
Sunday, July 11, 2004

if you go to google and you search "first 10-digit prime found in consecutive digits" and you click the first website that comes up (it should be "Google Blog - News and tips about Google") or press "I'm feeling lucky", you'll find the google blog.  and in the google blog, it gives the first answer, this website, and a link directly to the last website. you don't even have to do anything, it just links you to the finish.

I don't know if anyone's already said this, I'm too lazy to check.

I'm going to be a juniour in HS next year
Sunday, July 11, 2004

oops I spelled junior wrong

I'm going to be a junior in HS next year
Sunday, July 11, 2004

I just checked again and its the second website on the list now

I'm going to be a junior in HS next year
Sunday, July 11, 2004

now its first again

I'm going to be a junior in HS next year
Sunday, July 11, 2004

Hmmm. 49.  Someone at Google must be big niners fan. 

Sequences adding up to 42 would have been way more clever, IMHO, as a homage to the late Douglas Adams and his answer to life, the universe, and everything.  Isn't that what Google helps the rest of us seek after all?

H.P.
Sunday, July 11, 2004

If you promise not to kill me, here's the C# code :-D.

using System;

namespace MadHamster
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class GoogleProblemSolver
    {
        /// <summary>The main entry point for the application.</summary>
        [STAThread]
        static void Main(string[] args)
        {
            Console.WriteLine("Answer to Problem 1: " + Problem1().ToString());
            Console.WriteLine("Answer to Problem 2: " + Problem2().ToString());
        }

        #region Problem Functions
        private static ulong Problem1()
        {
            for(int i = 0; i < length - 10; ++i)
            {
                string    tenDigits    = GoogleProblemSolver.e.Substring(i, 10);
                ulong    iTenDigits    = Convert.ToUInt64(tenDigits);

                if(GoogleProblemSolver.IsPrime(iTenDigits))
                {
                    return iTenDigits;
                }
            }

            return 0;
        }
        private static ulong Problem2()
        {
            for(int i = 0; i < length - 10; ++i)
            {
                string tenDigits    = GoogleProblemSolver.e.Substring(i, 10);

                if(tenDigits == "7182818284" || tenDigits == "8182845904" || tenDigits == "8747135266" || tenDigits == "7427466391")
                {
                    continue;
                }

                int sum = 0;
                foreach(char digit in tenDigits)
                {
                    sum += Convert.ToInt32(new string(digit, 1));
                }

                if(sum == 49)
                {
                    return Convert.ToUInt64(tenDigits);
                }
            }

            return 0;
        }
        #endregion

        #region Utility Functions
        private static bool IsPrime(ulong number)
        {
            if(number < 2)
            {
                return false;
            }

            ulong uLimit = (ulong)Math.Sqrt(number) + 1;
            for(ulong i = 2; i < uLimit; ++i)
            {
                if(number % i == 0)
                {
                    return false;
                }
            }

            return true;
        }
        #endregion

        #region Fields
        private static string e =    "718281828459045235360287471352662497757247093699959574966" +
                                    "967627724076630353547594571382178525166427427466391932003059" +
                                    "921817413596629043572900334295260595630738132328627943490763" +
                                    "233829880753195251019011573834187930702154089149934884167509" +
                                    "244761460668082264800168477411853742345442437107539077744992" +
                                    "069551702761838606261331384583000752044933826560297606737113" +
                                    "200709328709127443747047230696977209310141692836819025515108" +
                                    "657463772111252389784425056953696770785449969967946864454905" +
                                    "987931636889230098793127736178215424999229576351482208269895" +
                                    "193668033182528869398496465105820939239829488793320362509443" +
                                    "117301238197068416140397019837679320683282376464804295311802" +
                                    "328782509819455815301756717361332069811250996181881593041690" +
                                    "351598888519345807273866738589422879228499892086805825749279" +
                                    "610484198444363463244968487560233624827041978623209002160990" +
                                    "235304369941849146314093431738143640546253152096183690888707" +
                                    "016768396424378140592714563549061303107208510383750510115747" +
                                    "704171898610687396965521267154688957035035402123407849819334" +
                                    "321068170121005627880235193033224745015853904730419957777093" +
                                    "503660416997329725088687696640355570716226844716256079882651" +
                                    "787134195124665201030592123667719432527867539855894489697096" +
                                    "409754591856956380236370162112047742722836489613422516445078" +
                                    "182442352948636372141740238893441247963574370263755294448337" +
                                    "998016125492278509257782562092622648326277933386566481627725" +
                                    "164019105900491644998289315056604725802778631864155195653244";
        private static int length = GoogleProblemSolver.e.Length;
        #endregion

    }
}

Domenic Denicola
Sunday, July 11, 2004

Argh, that was UGLY! Sorry, please feel free to delete that. O_O. SORRY!

Domenic Denicola
Sunday, July 11, 2004

I just want to thank whoever came up with this marketing ploy for f*ing making me change my phone number!

CHEECH VOGEL
Monday, July 12, 2004

This is really annoying me.  If you use a cubic regression on it, you get something that matches perfectly with 1-4, but the result for 5 is not the correct password.  With a little help from Excel, you get:

y = -241369996.499969000*x^3 + 1230350849.999910000*x^2 - 1001434954.499540000*x + 7195272384.998980000

Did anyone else thing about doing this like this??

Bryan
Monday, July 12, 2004

Huh??  Why would cubic regression give you the answer?

The function is not a polynomial function!  It is an arbitrary made up one ( f(n) = the nth sequence of 10 consecutive digits of e that adds up to 49).

You can interpolate the first 4 points in any number of ways (a quartic equation, make up another constraint, a quintinc equation, make up 2 more constraints), but they will all be wrong answers!

Roose
Monday, July 12, 2004

The website www.linux.org has no user by the name of Bobsyouruncle or bobsyouruncle.

Try this
http://www.linux.org/user/problem.html

and in the last section (where it sends out the password by e-mail) both the logins.

Manu Rastogi
Monday, July 12, 2004

An easier way to generate N digits of e is to use the program "bc".
  bc
  scale=2000
  e(1)

-r

ras
Monday, July 12, 2004

/***
There is more than one way to skin a kitty.  I loaded the natural log numbers into a single column table of text, ran this script, and voila!  The Mazel tov reference on their web site is interesting.
***/

DECLARE @TextLength  INT
DECLARE @i          SMALLINT
DECLARE @Sum        SMALLINT
DECLARE @Fn          SMALLINT
--
SELECT @TextLength = LEN(text) FROM Table1
SET @i  = 1
SET @Fn  = 0
--
CREATE TABLE #tempForOutput  ([Function]  SMALLINT,
                                Position  SMALLINT,
                                Numbers    CHAR(10))     
--
WHILE (@i < (@TextLength - 9))
  BEGIN
    SELECT @Sum  =CAST(SUBSTRING(Text, @i,    1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 1, 1) AS INT) +     
                  CAST(SUBSTRING(Text, @i + 2, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 3, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 4, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 5, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 6, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 7, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 8, 1) AS INT) +
                  CAST(SUBSTRING(Text, @i + 9, 1) AS INT)
    FROM Table1
    --
    IF @Sum = 49
        BEGIN
          SET @Fn = @Fn + 1
          INSERT INTO #tempForOutput
                      SELECT  @Fn,
                              @i,
                              SUBSTRING(Text, @i, 10)
                      FROM Table1
        END
    --
    SET @i = @i + 1
  END
SELECT * FROM #tempForOutput
DROP TABLE #tempForOutput
/*****
Function Position Numbers   
-------- -------- ----------
1        1        7182818284
2        5        8182845904
3        23      8747135266
4        99      7427466391
5        127      5966290435
6        145      2952605956
7        283      0753907774
8        288      0777449920
9        382      3069697720
10      428      1252389784
11      481      3163688923
12      515      9229576351
13      525      4822082698
14      580      8879332036
15      633      6832823764
16      634      8328237646
17      666      8194558153
18      696      2509961818
*****/

Jeff Weisbecker
Monday, July 12, 2004

La respuesta es la sig. 5966290435

Juanma
Monday, July 12, 2004

Does anybody interested to see the first 5 millions digit of e?

http://antwrp.gsfc.nasa.gov/htmltest/gifcity/e.5mil

snoyd
Monday, July 12, 2004

This page is already gone: http://www.google.com/labjobs/index.html

However this page: http://www.google.be/labjobs/index.html is still there. Time to keep our eyes pealed here in Belgium.

On a side-note: the popularity of everything even slightly surrounding Google really doesn't have any limits, does it?

FlexFlint
Monday, July 12, 2004

This is a bc/perl solution to this problem:

echo "scale=1000; e(1)" | bc -l | perl -0777 -ne 's/[^0-9]//g; for $i (0..length($_)-10) {$j=substr($_,$i,10); $s=0; $s+=$_ for split"",$j; print "$i\t$j\n" if $s==49;}'

of course it could be shortened, but this is what i first wrote.

mik
Tuesday, July 13, 2004

5966290435

Dan Rudolph
Tuesday, July 13, 2004

what is it with 'l33t' perl developers who feel the need to post their code with all whitespace removed?  Does it mean you're some sort of genius because you can deliberately obfuscate?  Give me a break.

I write perl practically double spaced with indentation all over the damned place.

muppet from madebymonkeys.net
Tuesday, July 13, 2004

I did not remove any whitespace from my code nor did obfuscate it any way. It is just as i wrote it. This is a one-liner intended to be run from the shell. LF characters do not help in such a situation. Believe me.

If you want to have this in many lines, i can add some LFs/indentation for you:

#!/bin/sh
echo "scale=1000; e(1)" | bc -l | \
perl -0777 -ne '
s/[^0-9]//g;
for $i (0..length($_)-10)
{
  $j=substr($_,$i,10);
  $s=0;
  $s+=$_ for split"",$j;
  print "$i\t$j\n" if $s==49;
}'

You can use it as a stand-alone sh script, just put it into a file and make it executable.

mik
Tuesday, July 13, 2004

It's interesting to note that while the n'th series of 10 digit numbers adding up to 49 works,  the third order polynomial fits too.

While the previous person who mentioned this got into some precisision errors, the equation:

-241369996.5 x^3 + 1230350850 x^2 -1001434954.5 x + 7195272385 = f (x) models the numbers exactly.

Interesting that both solutions match the first four terms . . . I wonder if there's some higher level explanation for what appears to me to be a coincidence?

ernie
Tuesday, July 13, 2004

and in php:

<?php

$e = "<digits of e>";

for($i=0;$i<strlen($e);$i++)
{
  $s=0;
  for($j=0;$j<10;$j++)
        $s += ord($e[$i+$j])-48;
    if($s == 49)
        echo substr($e, $i, 10)."<br>\n";
}

?>

asdf
Tuesday, July 13, 2004

// Solution to the Google puzzle, level 2
#include <iostream>
using namespace std;
                                                                                                                                                             
string e = "71828182845904523536028747135266249775724709369995957496696762772\
40766303535475945713821785251664274274663919320030599218174135966290435729003\
342952605956307381323286279434907632338298807531952510190115738341879307";
                                                                                                                                                             
string row;
int sum = 0;
                                                                                                                                                             
void process(char c) {
        sum += c - row[0]; row = row.substr(1) + c; // Process
        if (sum == 49) cout << row << endl; // Print if found
}
                                                                                                                                                             
int main() {
        row.assign(10, '0'); // Initialize
        for_each(e.begin(), e.end(), process); // Find solutions
        return 0;
}

Easily done in about four lines of actual code. Yeah, it uses global variables, but it still gets the job done and the code is easy to read. So, snake lovers and line noise writers... How about trying to beat me?

Lasse Kärkkäinen / Tronic
Tuesday, July 13, 2004

I might add that the above code is C++ and you can build it with g++ gsolve.cpp -o gsolve -Wall -pedantic (on systems with GCC installed).

Lasse Kärkkäinen / Tronic
Tuesday, July 13, 2004

They should have said "second 10-digit prime in consecutive digits of e" since the first one is 0000000002.  7427466391 comes much later in the left to right decimal expression of e.

Robert Shaw
Wednesday, July 14, 2004

bleh . . . silly me . . . of course a function with 4 points is going to fit a 3rd order polynomial . . .

ernie
Wednesday, July 14, 2004

(defun get-answer (s)
  (loop for substring = s then (subseq substring 1)
        until (< (length substring) 10)
        when  (= 49 (sum-chars (subseq substring 0 10)))
          do (print (subseq substring 0 10))))

(defun sum-chars (string)
  (loop for char across string summing (- (char-int char) 48)))

(get-answer "27182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307")

Lasse, I don't like this unnatural code optimized for compression. K or APL would have been my first choice, had I time to learn it. But it's still a readable, complete Common Lisp program and gives me the right answer. No global variables, no religion about functional programming, no packages or imports, no semicolons or slashes. Just fast iteration and clear concept.

Well, you called me a snake lover. ;) Think of it more like amoebas.

Tayssir John Gabbour
Wednesday, July 14, 2004

Oh and don't forget, the Mathematica guy beat us both. ;) Best tool for the job...

(Of course, I don't know how good Mathematica is for exploratory puzzle-solving. Our two entries aren't even about puzzle-solving, but coding to a spec while minimizing lines of code.)

Tayssir John Gabbour
Wednesday, July 14, 2004

Ok, even shorter. But this is my last one since this contest is silly. ;) I'm sure others can make it even shorter.

(defun get-answer (s)
  (loop for start from 0 to (- (length s) 10)
        when (= 49 (sum-chars (subseq s start (+ start 10))))
        do (print (subseq s start (+ start 10)))))

(defun sum-chars (string)
  (loop for char across string summing (- (char-int char) 48)))

(get-answer "27182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307")

Tayssir John Gabbour
Wednesday, July 14, 2004

The best thing about two-step approach is that they can always change the task on step#2 and get people directed to another e-mail for submitting CVs (although most of the fun's probably already gone).

Alex
Wednesday, July 14, 2004

PHP again:

<?php
$e .= "71828182845904523536028747135266249775724709369995957496696762772407663035354";
$e .= "75945713821785251664274274663919320030599218174135966290435729003342952605956";

$a = array_map('chr',unpack('c*',$e));
for($i=0;$i<count($a);$i++)
    if(array_sum(array_slice($a,$i,10)) == 49)
        echo implode('',array_slice($a,$i,10))."<br>\n";
?>

asdf
Wednesday, July 14, 2004

wow..... that is hardcore.... I don't have a clue nore a desire to be this smart.. lol  good job everyone

Retarded
Wednesday, July 14, 2004

I have found another solution that gives a different answer that obviously doesn't work as the password to the "Bobsyouruncle" login on www.Linux.org. There are possibly other solutions too.
To recap, the problem is:
f(1)= 7182818284
f(2)= 8182845904
f(3)= 8747135266
f(4)= 7427466391
f(5)= ???
In the value of "e" (given below upto 437 places after the decimal), the above numbers fall at positions 1, 5, 23 and 100 after the decimal point (note that the last one mentioned is not at position 99 as stated elsewhere in this forum).

At least one equation meets this pattern:
X(n)=(F(3n+3) - 2*F(n+1))/6,
where F(x) = F(x-1) + F(x-2)

Many of you know that F(x) is known as the Fibbonacci sequence.
e.g. F(0) = 0, F(1) = 1, F(2) = 1, F(3) = 2, F(4) = 3,
F(5)=5, F(6)=8, then
13, 21, 34,55,89,144,233,377,610,987,1597,2584 ...

Now look at the 1, 5, 23, 100 sequence in Google's problem:
X(1) = (F(6) - 2*F(2))/6 = (8 - 2)/6 = 1
X(2) = (F(9) - 2*F(3))/6 = (34 - 4)/6 = 5
X(3) = (F(12) - 2*F(4))/6 = (144 - 6)/6 = 23
X(4) = (F(15) - 2*F(5))/6 = (610-10)/6 = 100
AND THEN...
X(5) = (F(18) - 2*F(6))/6 = (2584 - 16)/6 = 428

So, it follows that the next 10-digit number in "e" should start at the position 428 after the decimal point. So the answer turns out to be 1112523897 by this method.

Basically, Google's f(5) = 1112523897

This "1112523897" doesn't pass on the website though I think they should let it pass. The right thing for them to do would be to have two passwords for the Bobsyouruncle account though this may require a bit of code change at their end (and they may need to increase the number of passwords as people find more solutions).

This exercise shows is that you should really give a lot more numbers in a sequence to reduce the possibility of alternate solutions.

BTW, here is the value of "e" (don't count newlines if you use editor tool):
2.71828182845904523536028747135266249775724709369995957496696762772407663035354
759457138217852516642742746639193200305992181741359662904357290033429526059563
073813232862794349076323382988075319525101901157383418793070215408914993488416
750924476146066808226480016847741185374234544243710753907774499206955170276183
860626133138458300075204493382656029760673711320070932870912744374704723069697
72093101416928368190255151086574637721112523897
.........

Regards,
Sanandan

sanandan swam
Friday, July 16, 2004

how did you came out with this equation?

i
Friday, July 16, 2004

Is google just another example therefore, of a recruiter saying they think "out of the box", but actually work within very predefined boundaries?

It you're correct, there's more than one answer, however some methods of getting there are "more correct than others" it seems ...

Bah.

Charles Babbage's great great grandson
Sunday, July 18, 2004

There is more than one billboard on 101. Another is between US680 and US880 heading North.

Stuck in traffic on 101
Tuesday, July 20, 2004

Yes, but this also means that google is casting the recruitment net within a VERY specific geographical area.

Gee, if they'd done this 15 years ago, they'd would have found Mr Torvalds in Finland ...

I don't think they're bothered. Personally, I've used Vivisimo.com as a document clustering / meta search system for over a year.

It's much better than google.

Charles Babbage's great great grandson
Wednesday, July 21, 2004

There's one in downtown Seattle, too.  I forget which street it was on (I don't know the city all that well, I just happened to be there on foot last week), but it's on a huge banner hanging on the side of a building (somewhere east of Pike).

W. Tucker
Monday, July 26, 2004

Perhaps directing people to the Linux.org website also means they're looking for a specific kind of developers.

Irene
Monday, July 26, 2004

If you want, please take a look at my solve:

http://wernerkai.sites.uol.com.br/google/google.htm

Werner Augusto Roder Kai
Wednesday, July 28, 2004

If you could figure out the initial pattern (sum =49) and the string came from the value of 'e' then getting the next value it was easiest accomplished in VB.  Sorry if I missed it in the earlier posts but...

Using this method though, the 4th combination is not the same as f(4) but if you keep clicking 'ok' until the 4th combination comes up, the next one is the password.  I know it's a little late but hey, I didn't find  this site until now. 

Dim e As String
Dim GetTen As String
Dim NumberNum As String
Dim Sum As Integer
e = "7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431"

Sum = 0
NumberNum = 0
    GetTen = Left(e, 10)
    For x = 0 To 9
        CurrentString = GetTen
        NumberNum = Mid(GetTen, x + 1, 1)
        Sum = Sum + Int(NumberNum)
        If Sum = 49 Then
            MsgBox CurrentString
        End If
    Next

For TrimE = 0 To Len(e)
    e = Right(e, Len(e) - 1)
    GetTen = Left(e, 10)
    Sum = 0
    NumberNum = 0
    For x = 0 To 9
        CurrentString = GetTen
        NumberNum = Mid(GetTen, x + 1, 1)
        Sum = Sum + Int(NumberNum)
        If Sum = 49 Then
            MsgBox CurrentString
        End If
    Next
Next

Doug Punchak
Monday, August 02, 2004

Updated value of e (was cut off in earlier post):
71828182845904523536028747135266249775724709369
99595749669676277240766303535475945713821785251
6642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901157383418793070215408914993488416750924476146066808226480016847741185374234544243710753907774499206955170276183860626133138458300
07520449338265602976067371132007093287091274437
470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992
29576351482208269895193668033182528869398496465
1058209392398294887933203625094431

Doug Punchak
Monday, August 02, 2004

I used Maple 7 for both levels of Google's riddles. Here's my solution for the first level...

> Digits:=300:
> E:=evalf(exp(1)):
> Digitlist:=[]:
>
> for i from 1 to Digits do
>    temp:=trunc(E):
>    Digitlist:=[op(Digitlist), temp]:
>    E:=10*(E-temp):
> end do:
>
> for that do
>    for this do
>      Ten:=0:
>      for i from 1 to 10 do
>          temp:=(10^(10-i))*op(i,Digitlist):
>          Ten:=Ten+temp:
>      end do:
>     
>      if (type(Ten,even)) then break;
>          elif isprime(Ten) then
>              Wahoo:=Ten:
>              print('WAHOO', Ten);
>              break;
>          else break;
>      end if:
>    end do:
>
> Digitlist:=subsop(1=NULL,Digitlist):
> end do:

Jason Lang
Tuesday, August 03, 2004

Depending on how to count indexes there three sequences with three diferent "wrong" answers :)
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A084615
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A007901
http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=A094012

Maxime
Monday, August 09, 2004

I solved it using openssl and C, if anyone's interested.

http://mattwalsh.com/twiki/bin/view/Main/GoogleBillboardContestFindingPrimesInE

Matt Walsh
Monday, August 09, 2004

Just to clarify, though this topic is old and dead, if f(1) occurs at 1, f(2)=5, f(3)=23, then f(4) is at 99 not 100.

J
Friday, August 13, 2004

Here's a link to a picture of the billboard...

http://mattwalsh.com/twiki/pub/Main/GoogleBillboardContestFindingPrimesInE/IMG_0742.JPG

Matt Walsh
Monday, August 16, 2004

ernie:
there's no coincidence on the fact that the cubic regression fits the formula perfectly on its first four terms.
If you have 4 points, there's only 1 cubic function that passes through all 4 points.

Pedro
Wednesday, August 18, 2004

Python code to find f(5):
e="27182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190"
for i in range(0, len(e)-10):
    e10 = e[i:i+10]
    if sum(map(int, e10))==49: print i,e10

Haven't yet seen code in any other language that is this short and easy to read

This code is what I initially wrote to solve it:
for i in range(0, len(e)-10):
    e10 = e[i:i+10]
    dig_sum = reduce(operator.add, map(int, e10))
    n = long(e10)
    if dig_sum==49:
        print "49:", i,n
  # and then did some other stuff with n before I found that it was sum over digits

Didn't need that much cleanup either.

Aloril
Friday, August 20, 2004

*  Recent Topics

*  Fog Creek Home