Puzzle modified from geometer website and solution can be found here (pdf file). Various smart people in the comments also got the correct answer!

Puzzle modified from geometer website and solution can be found here (pdf file). Various smart people in the comments also got the correct answer!

# Google+ Page // Facebook Page // Twitter Page

## 32 Comments

## Leave a comment

Profile pictures are tied to your email address and can
be set up at Gravatar.
Click here for recent comments.

(Note: You must have

If you make a mistake or the comment doesn't show up properly, email me and I'll gladly fix it :-).

(Note: You must have

**javascript**enabled to leave comments, otherwise you will get a comment submission error.)If you make a mistake or the comment doesn't show up properly, email me and I'll gladly fix it :-).

# Google+ Page // Facebook Page // Twitter Page

New to Spiked Math?

View the top comics.

View the top comics.

**New Feature:**Browse the archives in quick view! Choose from a black, white or grey background.
147112613210319486499676296015469376140521397487772312539818224915030479615918413181667804881965140 978577602879012396476181147114517095334951755284774296929590260545569265720366451220763460675369225 562092691997648611896298415668747092796050814927021662304746378459453311470775199933251758665556263 651853490184370195055575968818253407088121287627256915970363971231352356863999999999999999999999999 999999999999999999999

That was fast!

It's not hard; just observe that order doesn't matter, and use a language with no overload (like, say... python?).

You mean overflow, which is what happened in the strip. :P

If I understand the puzzle correctly the answer is in the following link:

wolfram alpha

42, duh.

I approve.

order is not important

this beat matlab. sample output:

...

i =

130

poop =

2.8118e+307

i =

131

poop =

Inf

i like the 'poop' thing :P

It bothers me that I don't know how to approach this problem...

find all prime numbers than connect the smallest to the largest in the formula x+y+xy (since the output is greatest when the numbers are closest) continue to so so until only 1 value is left

1.29700.... * 10^416

Key insight here is that the "x + y + x*y" operator is associative and commutative, which means that no matter what combinations you pick, the result will always be the same.

My python script agrees with Bronte

...and the reason that m(x,y)=x+y+xy is associative and commutative is that it's just ordinary multiplication in disguise: m(x,y)+1 = (x+1) (y+1). That means that the product of n+1 over all numbers n on the blackboard is an invariant, so it must end up at its initial value (2+1)(3+1)(5+1)(7+1)...(997+1), and thus the final number is 1 less than this product, QED.

<3 for this puzzle.

I liked this puzzle! I got to the point of realizing order doesn't matter, but still made the mistake of trying to calculate the product of primes and getting infinity...

Are there any easy ways to compute it without using a package with unlimited-length-integer support (Matlab / Mathematica / specialist libraries)? It would take quite a while to do by hand...

Hi.. all

Is my following approach correct fr this puzzle,

Matlab:

a=primes(1000)';

while length(a)>1

a=[a(1:length(a)-2);a(length(a))+a(length(a)-1)+(a(length(a))*a(length(a)-1))];

end

got answer as Infinity..

but i din find min value for 'diff combinations', did i miss dat actually..?

You guys having problems with this in MATLAB? Works nicely:

digits(500);

p = vpa(primes(1000));

prod(p+1)-1

ans =

147112613210319486499676296015469376140521397487772312539818224915030479615918413181667804881965140978577602879012396476181147114517095334951755284774296929590260545569265720366451220763460675369225562092691997648611896298415668747092796050814927021662304746378459453311470775199933251758665556263651853490184370195055575968818253407088121287627256915970363971231352356863999999999999999999999999999999999999999999999.0

Probably those getting "inf" on program runs are really seeing "overflow error".

Argh! I'm such an idiot! I just spent an age and a half trying to figure out why all of my attempts yielded something far larger than what the answer actually was, and then when I actually read the question properly I realised that I'd been using the first 1000 primes, instead of the primes up to 1000.

This is my code in python:

# primes is all prime numbers between 1 and 1000

reduce(lambda a,b: a*b, [i+1 for i in primes]) - 1

My Haskell version

now, entering returns:

147112613210319486499676296015469376140521

397487772312539818224915030479615918413181

667804881965140978577602879012396476181147

114517095334951755284774296929590260545569

265720366451220763460675369225562092691997

648611896298415668747092796050814927021662

304746378459453311470775199933251758665556

263651853490184370195055575968818253407088

121287627256915970363971231352356863999999

999999999999999999999999999999999999999

I used the infinite lazily-constructed list of primes and tookWhile (<1000) it.

There should really be something as a facebook "like" button for each comic :)

The stars at the top of the page let you rate them. Is that close enough?

I have the code already in place but with an /ignore/ tag. I'll remove the ignore and let's see how it goes with the facebook like code in place.

i have a close formula for that :D

R says integer overflow! bummer.

it's the sum, taken over all nonempty subsets of those primes, of the product of the elements of each subset.

Using J the result can easily be computed with this code:

(++*)/p:i.p:^:_1]1000x