do u know ramanujan numbers algorithm

Discussion in 'Java' started by emre esirik(hacettepe com. sci. and eng.), Feb 27, 2008.

  1. I think about ramanujan numbers and I need to know is there any
    algorithm for solving ramanujan numbers, please help me
     
    emre esirik(hacettepe com. sci. and eng.), Feb 27, 2008
    #1
    1. Advertising

  2. emre esirik(hacettepe com. sci. and eng.)

    rossum Guest

    On Wed, 27 Feb 2008 06:45:24 -0800 (PST), "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

    Assuming this is 1729 and friends, then there are a lot of links at:
    http://mathworld.wolfram.com/TaxicabNumber.html

    rossum
     
    rossum, Feb 27, 2008
    #2
    1. Advertising

  3. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    On Feb 27, 7:45 pm, "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.
     
    Sanny, Feb 27, 2008
    #3
  4. emre esirik(hacettepe com. sci. and eng.)

    Lew Guest

    Sanny wrote:
    > On Feb 27, 7:45 pm, "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.


    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?

    --
    Lew
     
    Lew, Feb 27, 2008
    #4
  5. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    On Feb 27, 10:13 pm, Lew <> wrote:
    > Sanny wrote:
    > > On Feb 27, 7:45 pm, "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.

    >
    > 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?
    >
    > --
    > 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.
     
    Sanny, Feb 27, 2008
    #5
  6. emre esirik(hacettepe com. sci. and eng.)

    Lew Guest

    "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


    Sanny wrote:
    >>> 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?


    Sanny wrote:
    > 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?

    Sanny wrote:
    > 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
    >> 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?


    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?


    --
    Lew
     
    Lew, Feb 27, 2008
    #6
  7. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    On Feb 27, 10:57 pm, Lew <> wrote:
    > "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

    > Sanny wrote:
    > >>> 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?

    > Sanny wrote:
    > > 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?
    >
    > Sanny wrote:
    > > 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
    > >> 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?

    >
    > 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?

    >
    > --
    > Lew- Hide quoted text -
    >
    > - 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
     
    Sanny, Feb 27, 2008
    #7
  8. emre esirik(hacettepe com. sci. and eng.)

    Eric Sosman Guest

    Sanny wrote:
    > [...]
    > 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.")

    --
     
    Eric Sosman, Feb 27, 2008
    #8
  9. emre esirik(hacettepe com. sci. and eng.)

    Lew Guest

    Lew asked:
    >> What about the O(n4) algorithmic inefficiency of that approach? Isn't there
    >> a better way?


    Sanny wrote:
    > 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!

    --
    Lew
     
    Lew, Feb 27, 2008
    #9
  10. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    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
     
    Sanny, Feb 28, 2008
    #10
  11. emre esirik(hacettepe com. sci. and eng.)

    bugbear Guest

    Sanny wrote:
    > 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.


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

    BugBear
     
    bugbear, Feb 28, 2008
    #11
  12. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    On Feb 28, 3:52 pm, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
    > Sanny wrote:
    > > 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.

    >
    > I will bear your philosophy in mind when answering any of your
    > future questions.
    >
    >     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
     
    Sanny, Feb 28, 2008
    #12
  13. emre esirik(hacettepe com. sci. and eng.)

    Roedy Green Guest

    On Wed, 27 Feb 2008 09:34:53 -0800 (PST), Sanny
    <> 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
     
    Roedy Green, Feb 29, 2008
    #13
  14. Roedy Green <> wrote:
    >>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? ;-)
     
    Andreas Leitgeb, Feb 29, 2008
    #14
  15. emre esirik(hacettepe com. sci. and eng.)

    Sanny Guest

    On Feb 29, 2:32 pm, Andreas Leitgeb <>
    wrote:
    > Roedy Green <> wrote:
    > >>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?  ;-)


    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
     
    Sanny, Feb 29, 2008
    #15
  16. emre esirik(hacettepe com. sci. and eng.)

    tsmc user

    Joined:
    Apr 5, 2011
    Messages:
    1
    tsmc user, Apr 5, 2011
    #16
  17. emre esirik(hacettepe com. sci. and eng.)

    Prasannabhore

    Joined:
    Jan 8, 2014
    Messages:
    1
    Can we have generalised equations for Ramanujan numbers like
    x^3+f(x)^3=g(x)^3+h(x)^3 .
    I Know three such equations.
     
    Prasannabhore, Jan 8, 2014
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ahmed Moustafa
    Replies:
    0
    Views:
    785
    Ahmed Moustafa
    Nov 15, 2003
  2. Bapaiah Katepalli
    Replies:
    1
    Views:
    1,506
    Mike Treseler
    Jun 23, 2006
  3. Ramanujan & Python

    , Sep 6, 2004, in forum: Python
    Replies:
    2
    Views:
    455
    Paul Rubin
    Sep 6, 2004
  4. emre esirik(hacettepe computer science and enginee

    do u know ramanujan numbers algorithm

    emre esirik(hacettepe computer science and enginee, Feb 27, 2008, in forum: C Programming
    Replies:
    4
    Views:
    397
    Richard Heathfield
    Feb 27, 2008
  5. Andries

    I know, I know, I don't know

    Andries, Apr 23, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    244
    Gregory Toomey
    Apr 23, 2004
Loading...

Share This Page