You are not logged in.
the number of ordered pairs of positive integers x,y such that x^2 +3y and y^2 +3x are both perfect squares
Offline
All permuations from (1,1) to (1001,1001) were tested by below BASIC program and only (1,1) was found as an answer.
This is an infintesimal subset of all infinity yet untested.
for x = 1 to 1001
for y = 1 to 1001
g = x^2 + 3*y
h = y^2 + 3*x
j= g^0.5
k= h^0.5
m=int(j)
n=int(k)
if (m=j) and (n=k) then print x;" ";y
next y
next x
print x;" program ended ";y
igloo myrtilles fourmis
Offline
Hi;
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Wow, my program didn't catch that, but it makes sense cause squares go up by odd numbers.
igloo myrtilles fourmis
Offline
Hi John;
if (m=j) and (n=k)
The problem is probably here. The test for equality between a floating point number and an integer is unreliable. Possibly better would be
if abs(m-j)<.000001 and abs(n-k)<.000001
This tests for magnitude rather than equality.
The constant .000001 could be smaller. I do not know the particulars of your BASIC, so I can not say for sure.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi JEF
try putting a print x;" ";y right after the if end tell me if it prints out all other numbers.
Here lies the reader who will never open this book. He is forever dead.
Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.
Offline
How did you solve this? can you please explain? I don't want to use computer program to solve how can I solve myself. If not possible then what is the thought process when inputting into computer program?
Offline
Hi addi;
It is just two loops for the computer solution. Of course it is not exhaustive.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Thats your explanation? I think I got the wrong forum later!!
Offline
Hi addi;
Sorry but your questions are rather general and I need more to provide some answer.
I don't want to use computer program to solve how can I solve myself.
No one attempted an analytical solution. So what can I help you with here? What have you done to solve this? Provide me with something and maybe I can take it a little further.
As for John's program it is up there. What about it don't you understand? Please be specific. Is it a command that you do not understand?
If not possible then what is the thought process when inputting into computer program
All the thought processes? What does this mean?
Please refrain from displays of temper. That helps no one. I am trying my best you can at least be polite.
Incidentally my answer if you had bothered to read it told you alot. For one thing it a simple program of only two loops and that it does not cover all the cases.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
My apologies. I do indeed have a bad temper and will try and refrain myself from displaying it in the future.
Offline
Hi;
What do you need help in?
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi,
I use LibertyBASIC, which for this problem gives a different answer depending on which square root method I use:
A....sqr(x^2 + 3*y) and sqr(y^2 + 3*x) finds x=1, y=1; x=11, y=11; x=16, y=11.
B....(x^2 + 3*y)^0.5 and (y^2 + 3*x)^0.5 finds x=1, y=1.
I guess that could mean that:
(a) A is more accurate than B within LB's precision range, or
(b) A is precise(!)
LB is accurate to 16 digits unless they're all integers, in which case LB has arbitrary precision.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Online
Hi phrontister;
a - int(a) = 0 and b - int(b) = 0 might be the problem. You are testing a float and an integer for equality. Better is to test there magnitudes.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi Bobby,
Yes, I thought that's what you meant re floats in your reply to John.
I don't know what you mean by "Better is to test there magnitudes", though.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Online
Hi;
You are assuming that the square root of a number in LB is an integer. For instance √ 4 might equal 1.999999999999 or 2.00000000001 in floating point.√ 36 might be 6.00000000003 or 5.999999999997. So when you test whether 6.00000000003 = 6 of course the program says no. I am just using these numbers as examples.
But if you recall the loop example from way back then we did not test for equality using = but magnitude Abs(√36 - 6)<.00000001 this would say yes.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Ah, yes. I see now that's what you told John. Sorry, I overlooked that.
So I guess that the idea would be to stay somewhere below LB's 16-digit precision limit with that magnitude number.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Online
Hi;
Yes, you would have to experiment with some small number. Remember to never trust floating point results. Even when they print .5 they mean internally .499999999999997
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Ok. I'll never trust a computer calc again and I'll go back to calculating the square root of a number longhand!
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Online
Hi;
That is a little severe. Want to see how to get the answer using M?
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi,
I am a student working on my BA degree in Mathematical Sciences. Up until about a year ago I thought I was pretty good in math because I usually got an A grade in my classes. However, I am realizing that I am probably the least knowlegable and least experienced Mathematician out there. So I have joined this forum and others to get help and practice and hopefully experience.
Looking at the question above I first thought that the two equations are identical. So if we solve for the first equation then we technically solved both equations. So if our answer for the first equation was X=16 then we know that Y=16 in the second equation. Now, I don't even know how to solve for the first equation. I can't even begin, if you can give me a hint... I will show you an effort on my end but what method should I consider?
How do I set: x^2 + 3y = perfect square?
Thanks again and I truely apologize for my behavior earlier.
Offline
Hi addi;
You need to solve
and
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Yes, I would like that. Just busy with something else atm, and I'd been thinking earlier of having a go at that myself first, maybe. I'll get back to you later. Thanks.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Online
Hi phrontister;
Okay, when you are ready I will show you what I did.
Hi addi;
Did you make any progress with post #22?
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hmmm,
I got 4 variables and only 2 equations. No progress I'm afraid.
My image didn't post?
Did the same for the other equations. Since x in the first equation should be equal to y in second equation then:
I know it is wrong???? And I don't care if I look stupid anymore I just want to learn this stuff. Please help!
Last edited by addi (2012-05-24 02:01:37)
Offline