Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

do u know ramanujan numbers algorithm

Thread view: 
emre esirik(hacettepe com. sci. and eng.) - 27 Feb 2008 14:45 GMT
I think about ramanujan numbers and I need to know is there any
algorithm for solving ramanujan numbers,  please help me
rossum - 27 Feb 2008 15:33 GMT
>I think about ramanujan numbers and I need to know is there any
>algorithm for solving ramanujan numbers,  please help me
Assuming this is 1729 and friends, then there are a lot of links at:
http://mathworld.wolfram.com/TaxicabNumber.html

rossum
Sanny - 27 Feb 2008 16:56 GMT
On Feb 27, 7:45 pm, "emre esirik(hacettepe com. sci. and eng.)"
<emreesi...@gmail.com> wrote:
> I think about ramanujan numbers and I need to know is there any
> algorithm for solving ramanujan numbers,  please help me

Make 4 for loops with int a,b,c,d

Check a^2+v^2=c^2+d^2

Whichever number follows print them you will find many such numbers.
Lew - 27 Feb 2008 17:13 GMT
> On Feb 27, 7:45 pm, "emre esirik(hacettepe com. sci. and eng.)"
> <emreesi...@gmail.com> wrote:
[quoted text clipped - 6 lines]
>
> Whichever number follows print them you will find many such numbers.

Shouldn't that calculation involve cubes rather than squares?

Doesn't the definition of "taxicab" numbers require that the number equal the
sums of two /different/ pairs of cubes?

Assuming you only want factors between 1 and 100, the suggested algorithm
requires 10^8 iterations.  At, say, 100 clock cycles per iteration, that's
about 10^10 clocks, or 50 seconds on a 2GHz CPU.  For a maximum root of 1000
it would take 10^12 iterations or 500,000 seconds, almost six days.

It would grow as to the fourth power of the maximum root, a rather big big O,
wouldn't you say?

To the OP:  What exactly do you mean by "solving ramanujan [sic] numbers"?  Do
you mean finding them?  Factoring them?  What?

Signature

Lew

Sanny - 27 Feb 2008 17:34 GMT
> > On Feb 27, 7:45 pm, "emre esirik(hacettepe com. sci. and eng.)"
> > <emreesi...@gmail.com> wrote:
[quoted text clipped - 25 lines]
> --
> Lew

Yes Ramanujm numbers are those numbers which follow this rul

a^3+b^3 =c^3+d^3=a Number

Then the Number is Called Ramanujm Number.

Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And print
those number.
Lew - 27 Feb 2008 17:57 GMT
"emre esirik(hacettepe com. sci. and eng.)" wrote:
>>>> I think about ramanujan numbers and I need to know is there any
>>>> algorithm for solving ramanujan numbers,  please help me

>>> Make 4 for loops with int a,b,c,d
>>> Check a^2+v^2=c^2+d^2
>>> Whichever number follows print them you will find many such numbers.

Lew wrote:
>> Shouldn't that calculation involve cubes rather than squares?

> Yes Ramanujm numbers are those numbers which follow this rul
>
> a^3+b^3 =c^3+d^3=a Number
>
> Then the Number is Called Ramanujm Number.

Lew wrote:
>> Doesn't the definition of "taxicab" numbers require that the number equal the
>> sums of two /different/ pairs of cubes?

Shouldn't that be addressed in the algorithm also?

> Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And print
> those number.

What about the O(n^4) algorithmic inefficiency of that approach?  Isn't there
a better way?

Lew wrote:
>> Assuming you only want factors between 1 and 100, the suggested algorithm
>> requires 10^8 iterations.  At, say, 100 clock cycles per iteration, that's
[quoted text clipped - 3 lines]
>> It would grow as to the fourth power of the maximum root, a rather big big O,
>> wouldn't you say?

Until the issues of duplicate results and algorithmic inefficiency are
addressed, I'd advise the OP to be skeptical of this approach.

This all still leaves open the question of what the OP wants:

>> To the OP:  What exactly do you mean by "solving ramanujan [sic] numbers"?  Do
>> you mean finding them?  Factoring them?  What?

Signature

Lew

Sanny - 27 Feb 2008 18:15 GMT
> "emre esirik(hacettepe com. sci. and eng.)" wrote:
>
[quoted text clipped - 43 lines]
>
> - Show quoted text -

I have O(n^2) algorithm in mind i will tell it if he really need it. I
will take $200 for this solution.

But only if He is really in need of this algorithm.

Bye
Sanny
Eric Sosman - 27 Feb 2008 18:45 GMT
> [...]
> I have O(n^2) algorithm in mind i will tell it if he really need it. I
> will take $200 for this solution.
>
> But only if He is really in need of this algorithm.

    He must be: He's multi-posted his question to half
of Usenet.  (For suitable values of "half.")

Signature

Eric.Sosman@sun.com

Lew - 27 Feb 2008 18:47 GMT
Lew asked:
>> What about the O(n4) algorithmic inefficiency of that approach?  Isn't there
>> a better way?

> I have O(n^2) algorithm in mind i will tell it if he really need it. I
> will take $200 for this solution.

Oh, my!

So is it fair to say that providing a bad algorithm was merely a way of
marketing the for-pay solution?  "Here's a bad answer, and if you pay me I'll
give a good answer"?

I would advise anyone who thinks of taking a poster up on such an offer to
review said poster's other posts to see if it is credible that their offer is
worth the suggested cost, speaking, of course, in the most general terms and
not about any one particular such (at best) dubious offer.

Seriously, Sanny, oh, my!

Signature

Lew

Sanny - 28 Feb 2008 07:28 GMT
I will have to invest my time in generating the O(n^2) algorithm. For
O(n^4) algorithm I gave it by withing in 10 seconds for free.

Its true I can give little work for free but to design something that
needs time I cant do that for free.

If you are ill you go to docter he may give a free advice. But incase
he need to do an Xray/ Or other diagnostic Tests then the cost
increases.

Simmilarly I can devote max 2-3 min for a O(n^2) Solution but if I
have to invest 2-3 hours then I atleast ask for $200. I generally take
$50-$100 / hr for Coding work. So $200 is reasionable. And I think the
Guy is rich enough to pay me that much.

Bye
Sanny
bugbear - 28 Feb 2008 10:52 GMT
> I will have to invest my time in generating the O(n^2) algorithm. For
> O(n^4) algorithm I gave it by withing in 10 seconds for free.
[quoted text clipped - 10 lines]
> $50-$100 / hr for Coding work. So $200 is reasionable. And I think the
> Guy is rich enough to pay me that much.

I will bear your philosophy in mind when answering any of your
future questions.

   BugBear
Sanny - 28 Feb 2008 16:26 GMT
> > I will have to invest my time in generating the O(n^2) algorithm. For
> > O(n^4) algorithm I gave it by withing in 10 seconds for free.
[quoted text clipped - 15 lines]
>
>     BugBear

I only ask for advices which you can give in 10-20 seconds I will
never ask something that will need you 2-3 hours.

Naturally You can see I have helped many people in
comp.lang.java.programmer But only when I can help in 1-2 min. I will
never waster 2-3 hours for a question and never want any one to devote
their precious hours solving my problems.

Bye
Sanny
Roedy Green - 29 Feb 2008 03:00 GMT
On Wed, 27 Feb 2008 09:34:53 -0800 (PST), Sanny
<softtanks@hotmail.com> wrote, quoted or indirectly quoted someone who
said :

>Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And print
>those number.

you could improve slightly on that brute force approach this way:

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).

That means your loops don't need to start at  but at a or c.

2. you can compute an approximation for d as
 Math.pow( a * a * a + b * b * b - c * c * c , 1./3.);
round to int, throw away anything not very close to int, and check
the int.

3. Use Jet. It will be clever about optimising the * inside loops.
see http://mindprod.com/jgloss/jet.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Andreas Leitgeb - 29 Feb 2008 09:32 GMT
>>Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And print
>>those number.
> you could improve slightly on that brute force approach this way:
> 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?  ;-)
Sanny - 29 Feb 2008 16:32 GMT
On Feb 29, 2:32 pm, Andreas Leitgeb <a...@gamma.logic.tuwien.ac.at>
wrote:
> >>Just follow 4 for loops And test a^3+b^3 =c^3+d^3=a Number And print
> >>those number.
[quoted text clipped - 22 lines]
>
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.