Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2012-05-14 15:47:22

juantheron
Member
Registered: 2011-10-19
Posts: 312

perfect square

the number of ordered pairs of positive integers x,y such that x^2 +3y and y^2 +3x are both perfect squares

Offline

#2 2012-05-14 20:25:15

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: perfect square

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

#3 2012-05-14 22:25:32

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#4 2012-05-15 00:52:36

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: perfect square

Wow, my program didn't catch that, but it makes sense cause squares go up by odd numbers.


igloo myrtilles fourmis

Offline

#5 2012-05-15 01:06:12

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#6 2012-05-15 01:24:31

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: perfect square

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

#7 2012-05-23 08:35:09

addi
Member
Registered: 2012-05-23
Posts: 8

Re: perfect square

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

#8 2012-05-23 09:13:12

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#9 2012-05-23 09:33:05

addi
Member
Registered: 2012-05-23
Posts: 8

Re: perfect square

Thats your explanation? I think I got the wrong forum later!!

Offline

#10 2012-05-23 09:53:21

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#11 2012-05-23 12:07:13

addi
Member
Registered: 2012-05-23
Posts: 8

Re: perfect square

My apologies. I do indeed have a bad temper and will try and refrain myself from displaying it in the future.

Offline

#12 2012-05-23 16:51:44

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#13 2012-05-24 00:08:16

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: perfect square

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

Offline

#14 2012-05-24 00:22:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#15 2012-05-24 00:34:47

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: perfect square

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

Offline

#16 2012-05-24 00:40:43

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#17 2012-05-24 00:55:41

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: perfect square

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

Offline

#18 2012-05-24 00:59:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#19 2012-05-24 01:06:05

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: perfect square

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

Offline

#20 2012-05-24 01:07:13

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#21 2012-05-24 01:11:35

addi
Member
Registered: 2012-05-23
Posts: 8

Re: perfect square

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

#22 2012-05-24 01:16:43

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#23 2012-05-24 01:26:53

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,877

Re: perfect square

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

Offline

#24 2012-05-24 01:32:18

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: perfect square

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

#25 2012-05-24 01:54:37

addi
Member
Registered: 2012-05-23
Posts: 8

Re: perfect square

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

Board footer

Powered by FluxBB