Diophantine equation: solving $a^2+4n=b^2$
up vote
-1
down vote
favorite
I found myself working with diophantine equations but I have no experience at all with them.
Given an integer $n$, can I find two integers, $a$ and $b$, such that
$$a^2+4n=b^2$$
How would you guys approach the problem?
Thank you in advance.
diophantine-equations square-numbers sums-of-squares
add a comment |
up vote
-1
down vote
favorite
I found myself working with diophantine equations but I have no experience at all with them.
Given an integer $n$, can I find two integers, $a$ and $b$, such that
$$a^2+4n=b^2$$
How would you guys approach the problem?
Thank you in advance.
diophantine-equations square-numbers sums-of-squares
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I found myself working with diophantine equations but I have no experience at all with them.
Given an integer $n$, can I find two integers, $a$ and $b$, such that
$$a^2+4n=b^2$$
How would you guys approach the problem?
Thank you in advance.
diophantine-equations square-numbers sums-of-squares
I found myself working with diophantine equations but I have no experience at all with them.
Given an integer $n$, can I find two integers, $a$ and $b$, such that
$$a^2+4n=b^2$$
How would you guys approach the problem?
Thank you in advance.
diophantine-equations square-numbers sums-of-squares
diophantine-equations square-numbers sums-of-squares
edited Nov 26 at 12:50
José Carlos Santos
146k22116216
146k22116216
asked Nov 26 at 12:34
Lyn Cassidy
436
436
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
up vote
0
down vote
accepted
Sure. With $a=n-1, b=n+1$ we have $$a^2+4n=n^2-2n+1+4n=n^2+2n+1=b^2$$
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
add a comment |
up vote
0
down vote
$$4n=b^2-a^2$$
$$n=dfrac{b+a}2cdotdfrac{b-a}2$$
If $n=pcdot q,dfrac{b+a}2=p, dfrac{b-a}2=q$
Trivially $q=1,p=?$
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
add a comment |
up vote
0
down vote
Here is a method to compute $0leq a,bleq 1000$ given n.
public static long diophantine(long n)
{
long fourn= 4*n;
long results = new long[2][1000];
int index=0;
for(int a=1;a<1000;a++)
{
double b=Math.sqrt(Math.pow((double)a, 2.0)+(double)fourn);
if((b % 1) == 0)
{
results[0][index]=a;
results[1][index]=(long)b;
index++;
}
}
return results;
}
SO for example, when $n=50$ gives(first column is the values of a and the second is the values of b :

Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
add a comment |
up vote
0
down vote
4 n = b^2 - a^2
n = g * h
4 n = (b - a) (b + a)
4 n = 2 g * 2 h
b - a = 2 g; b + a = 2 h
n = g h
a = h - g
b = h + g
if n = 7 then
(g=-7; h=-1 => a=6; b=-8 or
g=-1; h=-7 => a=-6; b=-8 or
g=1; h=7 => a=6; b=8 or
g=7; h=1 =>a=-6; b=8)
https://www.youtube.com/watch?v=dkf2xnmGHuA&index=8&list=PLfd6TTV3Dn5JUp6IDep5jV9wzOEmkpv4O
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3014261%2fdiophantine-equation-solving-a24n-b2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Sure. With $a=n-1, b=n+1$ we have $$a^2+4n=n^2-2n+1+4n=n^2+2n+1=b^2$$
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
add a comment |
up vote
0
down vote
accepted
Sure. With $a=n-1, b=n+1$ we have $$a^2+4n=n^2-2n+1+4n=n^2+2n+1=b^2$$
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Sure. With $a=n-1, b=n+1$ we have $$a^2+4n=n^2-2n+1+4n=n^2+2n+1=b^2$$
Sure. With $a=n-1, b=n+1$ we have $$a^2+4n=n^2-2n+1+4n=n^2+2n+1=b^2$$
answered Nov 26 at 12:38
lulu
38.5k24476
38.5k24476
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
add a comment |
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
Hi thank you too for your answer, are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:02
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
all the answers are trivial. Rewrite your equation as $4n=(b-a)(b+a)$. Write $4n=(2m)times (2k)$ for any factoring, $n=mk$ If $m≥k$ then solve $b+a=2m,b-a=2k$.
– lulu
Nov 26 at 13:07
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
So basically to get all the results you need to factorize n. I'll mark this as the correct solution.
– Lyn Cassidy
Nov 26 at 13:27
add a comment |
up vote
0
down vote
$$4n=b^2-a^2$$
$$n=dfrac{b+a}2cdotdfrac{b-a}2$$
If $n=pcdot q,dfrac{b+a}2=p, dfrac{b-a}2=q$
Trivially $q=1,p=?$
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
add a comment |
up vote
0
down vote
$$4n=b^2-a^2$$
$$n=dfrac{b+a}2cdotdfrac{b-a}2$$
If $n=pcdot q,dfrac{b+a}2=p, dfrac{b-a}2=q$
Trivially $q=1,p=?$
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
add a comment |
up vote
0
down vote
up vote
0
down vote
$$4n=b^2-a^2$$
$$n=dfrac{b+a}2cdotdfrac{b-a}2$$
If $n=pcdot q,dfrac{b+a}2=p, dfrac{b-a}2=q$
Trivially $q=1,p=?$
$$4n=b^2-a^2$$
$$n=dfrac{b+a}2cdotdfrac{b-a}2$$
If $n=pcdot q,dfrac{b+a}2=p, dfrac{b-a}2=q$
Trivially $q=1,p=?$
answered Nov 26 at 12:40
lab bhattacharjee
222k15155273
222k15155273
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
add a comment |
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
Hi, thanks for your answer. Are you aware of methods to find non-trivial solutions?
– Lyn Cassidy
Nov 26 at 13:00
add a comment |
up vote
0
down vote
Here is a method to compute $0leq a,bleq 1000$ given n.
public static long diophantine(long n)
{
long fourn= 4*n;
long results = new long[2][1000];
int index=0;
for(int a=1;a<1000;a++)
{
double b=Math.sqrt(Math.pow((double)a, 2.0)+(double)fourn);
if((b % 1) == 0)
{
results[0][index]=a;
results[1][index]=(long)b;
index++;
}
}
return results;
}
SO for example, when $n=50$ gives(first column is the values of a and the second is the values of b :

Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
add a comment |
up vote
0
down vote
Here is a method to compute $0leq a,bleq 1000$ given n.
public static long diophantine(long n)
{
long fourn= 4*n;
long results = new long[2][1000];
int index=0;
for(int a=1;a<1000;a++)
{
double b=Math.sqrt(Math.pow((double)a, 2.0)+(double)fourn);
if((b % 1) == 0)
{
results[0][index]=a;
results[1][index]=(long)b;
index++;
}
}
return results;
}
SO for example, when $n=50$ gives(first column is the values of a and the second is the values of b :

Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
add a comment |
up vote
0
down vote
up vote
0
down vote
Here is a method to compute $0leq a,bleq 1000$ given n.
public static long diophantine(long n)
{
long fourn= 4*n;
long results = new long[2][1000];
int index=0;
for(int a=1;a<1000;a++)
{
double b=Math.sqrt(Math.pow((double)a, 2.0)+(double)fourn);
if((b % 1) == 0)
{
results[0][index]=a;
results[1][index]=(long)b;
index++;
}
}
return results;
}
SO for example, when $n=50$ gives(first column is the values of a and the second is the values of b :

Here is a method to compute $0leq a,bleq 1000$ given n.
public static long diophantine(long n)
{
long fourn= 4*n;
long results = new long[2][1000];
int index=0;
for(int a=1;a<1000;a++)
{
double b=Math.sqrt(Math.pow((double)a, 2.0)+(double)fourn);
if((b % 1) == 0)
{
results[0][index]=a;
results[1][index]=(long)b;
index++;
}
}
return results;
}
SO for example, when $n=50$ gives(first column is the values of a and the second is the values of b :

answered Nov 26 at 13:05
mathnoob
1,691322
1,691322
Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
add a comment |
Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
Hi, thanks for the effort, but this is what i was trying to avoid: no loops, just a straight up equation.
– Lyn Cassidy
Nov 26 at 13:24
add a comment |
up vote
0
down vote
4 n = b^2 - a^2
n = g * h
4 n = (b - a) (b + a)
4 n = 2 g * 2 h
b - a = 2 g; b + a = 2 h
n = g h
a = h - g
b = h + g
if n = 7 then
(g=-7; h=-1 => a=6; b=-8 or
g=-1; h=-7 => a=-6; b=-8 or
g=1; h=7 => a=6; b=8 or
g=7; h=1 =>a=-6; b=8)
https://www.youtube.com/watch?v=dkf2xnmGHuA&index=8&list=PLfd6TTV3Dn5JUp6IDep5jV9wzOEmkpv4O
add a comment |
up vote
0
down vote
4 n = b^2 - a^2
n = g * h
4 n = (b - a) (b + a)
4 n = 2 g * 2 h
b - a = 2 g; b + a = 2 h
n = g h
a = h - g
b = h + g
if n = 7 then
(g=-7; h=-1 => a=6; b=-8 or
g=-1; h=-7 => a=-6; b=-8 or
g=1; h=7 => a=6; b=8 or
g=7; h=1 =>a=-6; b=8)
https://www.youtube.com/watch?v=dkf2xnmGHuA&index=8&list=PLfd6TTV3Dn5JUp6IDep5jV9wzOEmkpv4O
add a comment |
up vote
0
down vote
up vote
0
down vote
4 n = b^2 - a^2
n = g * h
4 n = (b - a) (b + a)
4 n = 2 g * 2 h
b - a = 2 g; b + a = 2 h
n = g h
a = h - g
b = h + g
if n = 7 then
(g=-7; h=-1 => a=6; b=-8 or
g=-1; h=-7 => a=-6; b=-8 or
g=1; h=7 => a=6; b=8 or
g=7; h=1 =>a=-6; b=8)
https://www.youtube.com/watch?v=dkf2xnmGHuA&index=8&list=PLfd6TTV3Dn5JUp6IDep5jV9wzOEmkpv4O
4 n = b^2 - a^2
n = g * h
4 n = (b - a) (b + a)
4 n = 2 g * 2 h
b - a = 2 g; b + a = 2 h
n = g h
a = h - g
b = h + g
if n = 7 then
(g=-7; h=-1 => a=6; b=-8 or
g=-1; h=-7 => a=-6; b=-8 or
g=1; h=7 => a=6; b=8 or
g=7; h=1 =>a=-6; b=8)
https://www.youtube.com/watch?v=dkf2xnmGHuA&index=8&list=PLfd6TTV3Dn5JUp6IDep5jV9wzOEmkpv4O
edited Nov 27 at 15:50
answered Nov 27 at 15:38
S. I.
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3014261%2fdiophantine-equation-solving-a24n-b2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown