do u know ramanujan numbers algorithm

  • Thread starter emre esirik(hacettepe com. sci. and eng.)
  • Start date
E

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

I think about ramanujan numbers and I need to know is there any
algorithm for solving ramanujan numbers, please help me
 
S

Sanny

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

Lew

Sanny said:
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?
 
S

Sanny

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?

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

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.

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?

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

Sanny

:




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

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?

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?

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
 
E

Eric Sosman

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

Lew

Lew asked:
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!
 
S

Sanny

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
 
B

bugbear

Sanny said:
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
 
S

Sanny

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
 
R

Roedy Green

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
 
A

Andreas Leitgeb

Roedy Green said:
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? ;-)
 
S

Sanny

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
 
Joined
Jan 8, 2014
Messages
1
Reaction score
0
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top