Continued fraction of a square root
$begingroup$
If I want to find the continued fraction of $sqrt{n}$ how do I know which number to use for $a_0$? Is there a way to do it without using a calculator or anything like that? What's the general algorithm for computing it? I tried to read the wiki article but was overwhelmed and lost. I tried Googling but couldn't find a website that actually explained this question.
If anyone has a good site that answers these questions either, please let me know. Thanks!
number-theory continued-fractions
$endgroup$
add a comment |
$begingroup$
If I want to find the continued fraction of $sqrt{n}$ how do I know which number to use for $a_0$? Is there a way to do it without using a calculator or anything like that? What's the general algorithm for computing it? I tried to read the wiki article but was overwhelmed and lost. I tried Googling but couldn't find a website that actually explained this question.
If anyone has a good site that answers these questions either, please let me know. Thanks!
number-theory continued-fractions
$endgroup$
add a comment |
$begingroup$
If I want to find the continued fraction of $sqrt{n}$ how do I know which number to use for $a_0$? Is there a way to do it without using a calculator or anything like that? What's the general algorithm for computing it? I tried to read the wiki article but was overwhelmed and lost. I tried Googling but couldn't find a website that actually explained this question.
If anyone has a good site that answers these questions either, please let me know. Thanks!
number-theory continued-fractions
$endgroup$
If I want to find the continued fraction of $sqrt{n}$ how do I know which number to use for $a_0$? Is there a way to do it without using a calculator or anything like that? What's the general algorithm for computing it? I tried to read the wiki article but was overwhelmed and lost. I tried Googling but couldn't find a website that actually explained this question.
If anyone has a good site that answers these questions either, please let me know. Thanks!
number-theory continued-fractions
number-theory continued-fractions
edited Dec 27 '12 at 4:39
MJD
47.3k29213396
47.3k29213396
asked Dec 27 '12 at 1:37
user51819user51819
5561314
5561314
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
$begingroup$
Let's just do an example. Let's find the continued fraction for $defsf{sqrt 5}sf$. $sfapprox 2.23$ or something, and $a_0$ is the integer part of this, which is 2.
Then we subtract $a_0$ from $sf$ and take the reciprocal. That is, we calculate ${1over sf-2}$. If you're using a calculator, this comes out to 4.23 or so. Then $a_1$ is the integer part of this, which is 4. So:
$$sf=2+cfrac{1}{4+cfrac1{vdots}}$$
Where we haven't figured out the $vdots$ part yet. To get that, we take our $4.23$, subtract $a_1$, and take the reciprocal; that is, we calculate ${1over 4.23 - 4} approx 4.23$. This is just the same as we had before, so $a_2$ is 4 again, and continuing in the same way, $a_3 = a_4 = ldots = 4$:
$$sf=2+cfrac{1}{4+cfrac1{4+cfrac1{4+cfrac1vdots}}}$$
This procedure will work for any number whatever, but for $sf$ we can use a little algebraic cleverness to see that the fours really do repeat. When we get to the ${1over sf-2}$ stage, we apply algebra to convert this to ${1over sf-2}cdot{sf+2oversf+2} = sf+2$. So we could say that: $$begin{align}
sf & = 2 + cfrac 1{2+sf}\
2 + sf & = 4 + cfrac 1{2+sf}.
end{align}$$
If we substitute the right-hand side of the last equation expression into itself in place of $ 2+ sf$, we get:
$$ begin{align}
2+ sf & = 4 + cfrac 1{4 + cfrac 1{2+sf}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}}} \
& = cdots
end{align}
$$
and it's evident that the fours will repeat forever.
$endgroup$
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
|
show 3 more comments
$begingroup$
Confirm the algebraic identity:
$$sqrt n=a+frac{n-a^2}{a+sqrt n}$$
Then chose whatever value of 'a' you want, and just keep on pluging in $sqrt n$
$endgroup$
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
add a comment |
$begingroup$
$a_0$ is simply the largest integer such that $a^2 le n$ . You can determine the continued fraction for a square root by performing the $frac1{sqrt n - a_0}$ step and then using the conjugate to remove the square root from the denominator, and repeating.
I recommend Ron Knott's site: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html . Good Luck.
$endgroup$
add a comment |
$begingroup$
$a_0$ is the largest integer that is smaller than or equal to $sqrt n$. Or put another way, you want $a_0^2$ to be smaller than or equal to $n$, and $(a_0+1)^2$ to be bigger than $n$.
If you really have no idea what integer to use, then you find it by guessing an integer $g$. Then you calculate $g^2$. If $g^2$ is bigger than $n$, your guess $g$ was too big, and you try a smaller guess. If $g^2$ is much smaller than $n$, your guess $g$ was too small, and you try a bigger guess. You keep doing this until you find a guess $g$ where $g^2 le n$ and $(g+1)^2 > n$, and then $a_0 = g$.
$endgroup$
add a comment |
$begingroup$
Here the easiest method to generate continued fraction for any square (or more) root. Lets take $sqrt{5}$:
$$sqrt{5} approx 2,2360679775...$$
$$sqrt{5} = 2 + 0,2360679775$$
So $2=left lfloor sqrt(5) right rfloor$
$$sqrt{5} =2 + x$$ with $x=0,2360679775$
$$sqrt{5}^{2} = (x + 2)^{2} Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$frac{1}{x}= x + 4 Rightarrow x = frac{1}{4+x}$$
So $x = frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$
Finally, we got: $sqrt{5} = 2 + frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$.
So for any x, $sqrt(x) = left lfloor sqrt(x) right rfloor + frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor + ddots}}}$
So to answer, $a_0 =left lfloor sqrt(x) right rfloor$ (because any periodic continued fraction is smaller than 1).
$endgroup$
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
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',
autoActivateHeartbeat: false,
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%2f265690%2fcontinued-fraction-of-a-square-root%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Let's just do an example. Let's find the continued fraction for $defsf{sqrt 5}sf$. $sfapprox 2.23$ or something, and $a_0$ is the integer part of this, which is 2.
Then we subtract $a_0$ from $sf$ and take the reciprocal. That is, we calculate ${1over sf-2}$. If you're using a calculator, this comes out to 4.23 or so. Then $a_1$ is the integer part of this, which is 4. So:
$$sf=2+cfrac{1}{4+cfrac1{vdots}}$$
Where we haven't figured out the $vdots$ part yet. To get that, we take our $4.23$, subtract $a_1$, and take the reciprocal; that is, we calculate ${1over 4.23 - 4} approx 4.23$. This is just the same as we had before, so $a_2$ is 4 again, and continuing in the same way, $a_3 = a_4 = ldots = 4$:
$$sf=2+cfrac{1}{4+cfrac1{4+cfrac1{4+cfrac1vdots}}}$$
This procedure will work for any number whatever, but for $sf$ we can use a little algebraic cleverness to see that the fours really do repeat. When we get to the ${1over sf-2}$ stage, we apply algebra to convert this to ${1over sf-2}cdot{sf+2oversf+2} = sf+2$. So we could say that: $$begin{align}
sf & = 2 + cfrac 1{2+sf}\
2 + sf & = 4 + cfrac 1{2+sf}.
end{align}$$
If we substitute the right-hand side of the last equation expression into itself in place of $ 2+ sf$, we get:
$$ begin{align}
2+ sf & = 4 + cfrac 1{4 + cfrac 1{2+sf}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}}} \
& = cdots
end{align}
$$
and it's evident that the fours will repeat forever.
$endgroup$
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
|
show 3 more comments
$begingroup$
Let's just do an example. Let's find the continued fraction for $defsf{sqrt 5}sf$. $sfapprox 2.23$ or something, and $a_0$ is the integer part of this, which is 2.
Then we subtract $a_0$ from $sf$ and take the reciprocal. That is, we calculate ${1over sf-2}$. If you're using a calculator, this comes out to 4.23 or so. Then $a_1$ is the integer part of this, which is 4. So:
$$sf=2+cfrac{1}{4+cfrac1{vdots}}$$
Where we haven't figured out the $vdots$ part yet. To get that, we take our $4.23$, subtract $a_1$, and take the reciprocal; that is, we calculate ${1over 4.23 - 4} approx 4.23$. This is just the same as we had before, so $a_2$ is 4 again, and continuing in the same way, $a_3 = a_4 = ldots = 4$:
$$sf=2+cfrac{1}{4+cfrac1{4+cfrac1{4+cfrac1vdots}}}$$
This procedure will work for any number whatever, but for $sf$ we can use a little algebraic cleverness to see that the fours really do repeat. When we get to the ${1over sf-2}$ stage, we apply algebra to convert this to ${1over sf-2}cdot{sf+2oversf+2} = sf+2$. So we could say that: $$begin{align}
sf & = 2 + cfrac 1{2+sf}\
2 + sf & = 4 + cfrac 1{2+sf}.
end{align}$$
If we substitute the right-hand side of the last equation expression into itself in place of $ 2+ sf$, we get:
$$ begin{align}
2+ sf & = 4 + cfrac 1{4 + cfrac 1{2+sf}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}}} \
& = cdots
end{align}
$$
and it's evident that the fours will repeat forever.
$endgroup$
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
|
show 3 more comments
$begingroup$
Let's just do an example. Let's find the continued fraction for $defsf{sqrt 5}sf$. $sfapprox 2.23$ or something, and $a_0$ is the integer part of this, which is 2.
Then we subtract $a_0$ from $sf$ and take the reciprocal. That is, we calculate ${1over sf-2}$. If you're using a calculator, this comes out to 4.23 or so. Then $a_1$ is the integer part of this, which is 4. So:
$$sf=2+cfrac{1}{4+cfrac1{vdots}}$$
Where we haven't figured out the $vdots$ part yet. To get that, we take our $4.23$, subtract $a_1$, and take the reciprocal; that is, we calculate ${1over 4.23 - 4} approx 4.23$. This is just the same as we had before, so $a_2$ is 4 again, and continuing in the same way, $a_3 = a_4 = ldots = 4$:
$$sf=2+cfrac{1}{4+cfrac1{4+cfrac1{4+cfrac1vdots}}}$$
This procedure will work for any number whatever, but for $sf$ we can use a little algebraic cleverness to see that the fours really do repeat. When we get to the ${1over sf-2}$ stage, we apply algebra to convert this to ${1over sf-2}cdot{sf+2oversf+2} = sf+2$. So we could say that: $$begin{align}
sf & = 2 + cfrac 1{2+sf}\
2 + sf & = 4 + cfrac 1{2+sf}.
end{align}$$
If we substitute the right-hand side of the last equation expression into itself in place of $ 2+ sf$, we get:
$$ begin{align}
2+ sf & = 4 + cfrac 1{4 + cfrac 1{2+sf}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}}} \
& = cdots
end{align}
$$
and it's evident that the fours will repeat forever.
$endgroup$
Let's just do an example. Let's find the continued fraction for $defsf{sqrt 5}sf$. $sfapprox 2.23$ or something, and $a_0$ is the integer part of this, which is 2.
Then we subtract $a_0$ from $sf$ and take the reciprocal. That is, we calculate ${1over sf-2}$. If you're using a calculator, this comes out to 4.23 or so. Then $a_1$ is the integer part of this, which is 4. So:
$$sf=2+cfrac{1}{4+cfrac1{vdots}}$$
Where we haven't figured out the $vdots$ part yet. To get that, we take our $4.23$, subtract $a_1$, and take the reciprocal; that is, we calculate ${1over 4.23 - 4} approx 4.23$. This is just the same as we had before, so $a_2$ is 4 again, and continuing in the same way, $a_3 = a_4 = ldots = 4$:
$$sf=2+cfrac{1}{4+cfrac1{4+cfrac1{4+cfrac1vdots}}}$$
This procedure will work for any number whatever, but for $sf$ we can use a little algebraic cleverness to see that the fours really do repeat. When we get to the ${1over sf-2}$ stage, we apply algebra to convert this to ${1over sf-2}cdot{sf+2oversf+2} = sf+2$. So we could say that: $$begin{align}
sf & = 2 + cfrac 1{2+sf}\
2 + sf & = 4 + cfrac 1{2+sf}.
end{align}$$
If we substitute the right-hand side of the last equation expression into itself in place of $ 2+ sf$, we get:
$$ begin{align}
2+ sf & = 4 + cfrac 1{4 + cfrac 1{2+sf}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}} \
& = 4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{4 + cfrac 1{2+sf}}}} \
& = cdots
end{align}
$$
and it's evident that the fours will repeat forever.
edited Dec 27 '12 at 4:39
answered Dec 27 '12 at 1:59
MJDMJD
47.3k29213396
47.3k29213396
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
|
show 3 more comments
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
I always thought they were in the form a0 + 1/(a1 + 1/ (a2 + 1/( ...
$endgroup$
– user51819
Dec 27 '12 at 2:01
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
@user51819 Quite so (although $a_0$ could be 0.) I had the typesetting wrong, and have corrected it.
$endgroup$
– MJD
Dec 27 '12 at 2:03
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
$begingroup$
Sorry, one last question; how do we know, in the general sense, when we've hit the point where it's periodic? When you encounter an $a_k$ you've seen before? Or when a reciprocal equals a reciprocal you've seen before? I am guessing the latter?
$endgroup$
– user51819
Dec 27 '12 at 2:09
1
1
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
When the reciprocal is one you have seen before. It couldn't be when you reach an $a_k$ you've seen before or else you couldn't have a repeating sequence like $1,1,2,1,1,2,1,1,2,ldots$.
$endgroup$
– MJD
Dec 27 '12 at 2:15
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
$begingroup$
Incredible, really.
$endgroup$
– Meitar
Jun 13 '15 at 12:19
|
show 3 more comments
$begingroup$
Confirm the algebraic identity:
$$sqrt n=a+frac{n-a^2}{a+sqrt n}$$
Then chose whatever value of 'a' you want, and just keep on pluging in $sqrt n$
$endgroup$
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
add a comment |
$begingroup$
Confirm the algebraic identity:
$$sqrt n=a+frac{n-a^2}{a+sqrt n}$$
Then chose whatever value of 'a' you want, and just keep on pluging in $sqrt n$
$endgroup$
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
add a comment |
$begingroup$
Confirm the algebraic identity:
$$sqrt n=a+frac{n-a^2}{a+sqrt n}$$
Then chose whatever value of 'a' you want, and just keep on pluging in $sqrt n$
$endgroup$
Confirm the algebraic identity:
$$sqrt n=a+frac{n-a^2}{a+sqrt n}$$
Then chose whatever value of 'a' you want, and just keep on pluging in $sqrt n$
edited Dec 27 '12 at 2:06
answered Dec 27 '12 at 1:51


EthanEthan
6,87512164
6,87512164
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
add a comment |
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
2
2
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
$begingroup$
With this you end up with generalized continuous fraction. I mean $n-a^2$ not necessarily $1$.
$endgroup$
– Yola
Oct 24 '16 at 17:59
1
1
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
This is a sad case of changing the question to get a simpler answer (and that is assuming the question was how to find the continued fraction of $sqrt n$; in fact it was rather uninterestingly just about its first term, the integer part of $sqrt n$).
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:50
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
-1 As @Yola points out, this doesn’t (necessarily) give you a continued fraction
$endgroup$
– HelloGoodbye
Aug 30 '18 at 22:55
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
@HelloGoodbye OP changed his question, I answered what he originally asked.
$endgroup$
– Ethan
Sep 1 '18 at 1:06
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
$begingroup$
Okay. If so, shouldn't it be possible to see that here?
$endgroup$
– HelloGoodbye
Sep 1 '18 at 23:39
add a comment |
$begingroup$
$a_0$ is simply the largest integer such that $a^2 le n$ . You can determine the continued fraction for a square root by performing the $frac1{sqrt n - a_0}$ step and then using the conjugate to remove the square root from the denominator, and repeating.
I recommend Ron Knott's site: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html . Good Luck.
$endgroup$
add a comment |
$begingroup$
$a_0$ is simply the largest integer such that $a^2 le n$ . You can determine the continued fraction for a square root by performing the $frac1{sqrt n - a_0}$ step and then using the conjugate to remove the square root from the denominator, and repeating.
I recommend Ron Knott's site: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html . Good Luck.
$endgroup$
add a comment |
$begingroup$
$a_0$ is simply the largest integer such that $a^2 le n$ . You can determine the continued fraction for a square root by performing the $frac1{sqrt n - a_0}$ step and then using the conjugate to remove the square root from the denominator, and repeating.
I recommend Ron Knott's site: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html . Good Luck.
$endgroup$
$a_0$ is simply the largest integer such that $a^2 le n$ . You can determine the continued fraction for a square root by performing the $frac1{sqrt n - a_0}$ step and then using the conjugate to remove the square root from the denominator, and repeating.
I recommend Ron Knott's site: http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html . Good Luck.
answered Dec 27 '12 at 1:49
half-integer fanhalf-integer fan
840413
840413
add a comment |
add a comment |
$begingroup$
$a_0$ is the largest integer that is smaller than or equal to $sqrt n$. Or put another way, you want $a_0^2$ to be smaller than or equal to $n$, and $(a_0+1)^2$ to be bigger than $n$.
If you really have no idea what integer to use, then you find it by guessing an integer $g$. Then you calculate $g^2$. If $g^2$ is bigger than $n$, your guess $g$ was too big, and you try a smaller guess. If $g^2$ is much smaller than $n$, your guess $g$ was too small, and you try a bigger guess. You keep doing this until you find a guess $g$ where $g^2 le n$ and $(g+1)^2 > n$, and then $a_0 = g$.
$endgroup$
add a comment |
$begingroup$
$a_0$ is the largest integer that is smaller than or equal to $sqrt n$. Or put another way, you want $a_0^2$ to be smaller than or equal to $n$, and $(a_0+1)^2$ to be bigger than $n$.
If you really have no idea what integer to use, then you find it by guessing an integer $g$. Then you calculate $g^2$. If $g^2$ is bigger than $n$, your guess $g$ was too big, and you try a smaller guess. If $g^2$ is much smaller than $n$, your guess $g$ was too small, and you try a bigger guess. You keep doing this until you find a guess $g$ where $g^2 le n$ and $(g+1)^2 > n$, and then $a_0 = g$.
$endgroup$
add a comment |
$begingroup$
$a_0$ is the largest integer that is smaller than or equal to $sqrt n$. Or put another way, you want $a_0^2$ to be smaller than or equal to $n$, and $(a_0+1)^2$ to be bigger than $n$.
If you really have no idea what integer to use, then you find it by guessing an integer $g$. Then you calculate $g^2$. If $g^2$ is bigger than $n$, your guess $g$ was too big, and you try a smaller guess. If $g^2$ is much smaller than $n$, your guess $g$ was too small, and you try a bigger guess. You keep doing this until you find a guess $g$ where $g^2 le n$ and $(g+1)^2 > n$, and then $a_0 = g$.
$endgroup$
$a_0$ is the largest integer that is smaller than or equal to $sqrt n$. Or put another way, you want $a_0^2$ to be smaller than or equal to $n$, and $(a_0+1)^2$ to be bigger than $n$.
If you really have no idea what integer to use, then you find it by guessing an integer $g$. Then you calculate $g^2$. If $g^2$ is bigger than $n$, your guess $g$ was too big, and you try a smaller guess. If $g^2$ is much smaller than $n$, your guess $g$ was too small, and you try a bigger guess. You keep doing this until you find a guess $g$ where $g^2 le n$ and $(g+1)^2 > n$, and then $a_0 = g$.
answered Dec 27 '12 at 1:51
MJDMJD
47.3k29213396
47.3k29213396
add a comment |
add a comment |
$begingroup$
Here the easiest method to generate continued fraction for any square (or more) root. Lets take $sqrt{5}$:
$$sqrt{5} approx 2,2360679775...$$
$$sqrt{5} = 2 + 0,2360679775$$
So $2=left lfloor sqrt(5) right rfloor$
$$sqrt{5} =2 + x$$ with $x=0,2360679775$
$$sqrt{5}^{2} = (x + 2)^{2} Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$frac{1}{x}= x + 4 Rightarrow x = frac{1}{4+x}$$
So $x = frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$
Finally, we got: $sqrt{5} = 2 + frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$.
So for any x, $sqrt(x) = left lfloor sqrt(x) right rfloor + frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor + ddots}}}$
So to answer, $a_0 =left lfloor sqrt(x) right rfloor$ (because any periodic continued fraction is smaller than 1).
$endgroup$
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
add a comment |
$begingroup$
Here the easiest method to generate continued fraction for any square (or more) root. Lets take $sqrt{5}$:
$$sqrt{5} approx 2,2360679775...$$
$$sqrt{5} = 2 + 0,2360679775$$
So $2=left lfloor sqrt(5) right rfloor$
$$sqrt{5} =2 + x$$ with $x=0,2360679775$
$$sqrt{5}^{2} = (x + 2)^{2} Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$frac{1}{x}= x + 4 Rightarrow x = frac{1}{4+x}$$
So $x = frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$
Finally, we got: $sqrt{5} = 2 + frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$.
So for any x, $sqrt(x) = left lfloor sqrt(x) right rfloor + frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor + ddots}}}$
So to answer, $a_0 =left lfloor sqrt(x) right rfloor$ (because any periodic continued fraction is smaller than 1).
$endgroup$
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
add a comment |
$begingroup$
Here the easiest method to generate continued fraction for any square (or more) root. Lets take $sqrt{5}$:
$$sqrt{5} approx 2,2360679775...$$
$$sqrt{5} = 2 + 0,2360679775$$
So $2=left lfloor sqrt(5) right rfloor$
$$sqrt{5} =2 + x$$ with $x=0,2360679775$
$$sqrt{5}^{2} = (x + 2)^{2} Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$frac{1}{x}= x + 4 Rightarrow x = frac{1}{4+x}$$
So $x = frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$
Finally, we got: $sqrt{5} = 2 + frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$.
So for any x, $sqrt(x) = left lfloor sqrt(x) right rfloor + frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor + ddots}}}$
So to answer, $a_0 =left lfloor sqrt(x) right rfloor$ (because any periodic continued fraction is smaller than 1).
$endgroup$
Here the easiest method to generate continued fraction for any square (or more) root. Lets take $sqrt{5}$:
$$sqrt{5} approx 2,2360679775...$$
$$sqrt{5} = 2 + 0,2360679775$$
So $2=left lfloor sqrt(5) right rfloor$
$$sqrt{5} =2 + x$$ with $x=0,2360679775$
$$sqrt{5}^{2} = (x + 2)^{2} Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$frac{1}{x}= x + 4 Rightarrow x = frac{1}{4+x}$$
So $x = frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$
Finally, we got: $sqrt{5} = 2 + frac{1}{4+frac{1}{4+frac{1}{4+frac{1}{4+ddots}}}}$.
So for any x, $sqrt(x) = left lfloor sqrt(x) right rfloor + frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor+frac{x-left lfloor sqrt(x) right rfloor^{2}}{2left lfloor sqrt(x) right rfloor + ddots}}}$
So to answer, $a_0 =left lfloor sqrt(x) right rfloor$ (because any periodic continued fraction is smaller than 1).
answered Nov 21 '17 at 17:48
Julien BlanchonJulien Blanchon
412
412
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
add a comment |
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
$begingroup$
I am getting better at mentally doing square roots... generally to slide rule accuracy. But your answer mentions other roots, Could you amplify this a bit for cube roots?
$endgroup$
– richard1941
Apr 29 '18 at 0:57
2
2
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
How does this even work for say $sqrt 7$? In a continued fraction the numerators have to be $1$, which you don't get by this method.
$endgroup$
– Marc van Leeuwen
May 29 '18 at 10:48
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
$begingroup$
@MarcvanLeeuwen see math.stackexchange.com/q/3075250/432081
$endgroup$
– CopyPasteIt
Jan 16 at 2:49
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.
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%2f265690%2fcontinued-fraction-of-a-square-root%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