Friday, November 5, 2010

Project Euler

I recently landed on a site which gives you really awesome mathematical problems to solve. It is up to you to select the way you solve it, by hand/calc or by any one of the programming lang or any other way....

The idea is to come up with an algo in head or programming lang, and get a soln to it.
Now what facinated me is the fact that the problems are of such good level that not only it requires thinking, but also it requires some amount of search on mathematical ideas....

To give you an idea here's a Puzzle from the site :-


Q. A Pythagorean triplet is a set of three natural numbers, a < bc, for which,
a2 + b2 = c2^()^()^()
For example, 32 + 42 = 9 + 16 = 25 = 52.^()^()^()
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

 
( SPOILER ALERT )

Now I didn't know how to approach the problem at first.... I scribbled a bit, trying to reduce the number of parameters to two, but couldnt find a neat way...

Searched a bit, I found that the basic Pythagorean triplet is 3,4,5. If you multiply by a number n to all, for ex = 2. The new triplets are 6,8,10. If you check them they satisfy....

So i thought ok, the numbers are n ( a + b + c ) = 1000 where a, b, c
Thus n * 12 = 1000
n = 1000/12 = 83.333333333333333

Stumped!

Now what? N is not an integer!!!

Tried many combinations, realized that this method will not work....

Searched more.... and found an elegant way finally

for +ve integers of m, n where m < n
  • a = n2 - m2
  • b = 2nm
  • c = n2 + m2
Hence the new Equation becomes =>
n2 - m2 + 2nm + n2 + m2= 1000hence by solving it further,
n * ( m + n) = 500

If you put this eqn in Wolframalpha it will give you many soln, the ans you are looking for is both +ve, hence 20,5
Put the value and you get your ans....

Such Elegant way of learning not only maths, logic, but how to come up with algo....

Wish math was taught to me in this way, wouldn't have flunked my M3 exam and got a year down cause of it (yeah i have my m3 exam in a month).... 

Seeing all the great research, all the great discoveries, I have realized that Math is a very important field and should to be taken seriously... Maybe its a bit late but I think i'll try improving my basics and thinking of math slowly but steadly....
Go ahead and enjoy the world of math and logic...
Here's the link
This blog post is quite helpful for those who are serious at trying the problems or already are...

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.