Re: do u know ramanujan numbers algorithm
- From: Sanny <softtanks@xxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 08:32:01 -0800 (PST)
On Feb 29, 2:32 pm, Andreas Leitgeb <a...@xxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Roedy Green <see_webs...@xxxxxxxxxxxxxxxxxxxx> wrote:
Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And printyou could improve slightly on that brute force approach this way:
those number.
1. you don't need to find all the permutations, just the ones where
a < b, a < c, and c < d (perhaps <=, I am not familiar with the exact
rules).
You could also iterate only over two variables and save the values
of a^3+b^3 as keys in a map. Before actually adding it to the map,
you'd check for it's previous existence in the map: if it was
already there, you've found a solution.
Of course, when adding one, you need to store the value a as value
for key a^3+b^3, such that when you re-encounter the key, you also
know the previous a and (with simple math) b.
There's further potential for improvement by casually cleaning up
keys in the map that are small enough that re-encountering them
can be proven impossible. e.g. because it is smaller than current
a's cube.
Perhaps, it's even better to iterate the sum a+b in the other loop
and the difference (only till sign-change) in the inner loop, so you
do not have to decide on any maximum beforehand.
Has anyone paid the guy for a O(n^2) solution, yet? ;-)
Pay and get the Solution The guy has not responded it means he just
ask for curiosity.
Any one else interested pay me $200 for the solution.
Bye
Sanny
.
- References:
- do u know ramanujan numbers algorithm
- From: emre esirik(hacettepe com. sci. and eng.)
- Re: do u know ramanujan numbers algorithm
- From: Sanny
- Re: do u know ramanujan numbers algorithm
- From: Lew
- Re: do u know ramanujan numbers algorithm
- From: Sanny
- Re: do u know ramanujan numbers algorithm
- From: Roedy Green
- Re: do u know ramanujan numbers algorithm
- From: Andreas Leitgeb
- do u know ramanujan numbers algorithm
- Prev by Date: Re: Drawing Icons
- Next by Date: Re: Is there any free browser for Applet.
- Previous by thread: Re: do u know ramanujan numbers algorithm
- Next by thread: help getting castor to work
- Index(es):
Relevant Pages
|
|