parity of period of continued fraction of square root of prime number $p$











up vote
3
down vote

favorite
2












It is known that the period of continued fraction of a prime $sqrt p$ is odd if and only if $p equiv 1 pmod 4$. So when $p equiv 3 pmod 4$, the period is even.



But how do I prove the period of continued fraction of $sqrt p$ where $p$ $equiv 3 pmod 8$ is $2n$ ($n$ is odd) while the period of continued fraction of $sqrt p$ where $p$ $equiv 7 pmod 8$ is $2n$ ($n$ is even)?



I tried some examples and find that $x^2-pcdot y^2=2(-1)^n$ appears in the half of the period $- 1$ where $x$ and $y$ are its convergent, for instance continued fraction of $sqrt p$ is $[a_0 ; a_1,a_2,cdotcdotcdot,a_n]$, then $p_{frac n 2 -1}$ and $q_{frac n 2 -1}$ satisfies the equation $x^2-pcdot y^2=2(-1)^n$ where $x=p_{frac n 2 -1}$ and $y=q_{frac n 2-1}$.



I recall that Legendre symbol $left(displaystyle frac {~2~}{~p~}right)$ is $1$ when $p equiv 7 pmod 8$ while $left(displaystyle frac {~2~}{~p~}right)$ is $-1$ when $p equiv 3 pmod 8$, but cannot figure it out how I can relate them.



Is this the right way to approach?










share|cite|improve this question




















  • 1




    Can you give any reference for the fact you gave in first line?
    – Seewoo Lee
    Feb 9 '17 at 15:20










  • @See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
    – sibilant
    Feb 27 at 21:03

















up vote
3
down vote

favorite
2












It is known that the period of continued fraction of a prime $sqrt p$ is odd if and only if $p equiv 1 pmod 4$. So when $p equiv 3 pmod 4$, the period is even.



But how do I prove the period of continued fraction of $sqrt p$ where $p$ $equiv 3 pmod 8$ is $2n$ ($n$ is odd) while the period of continued fraction of $sqrt p$ where $p$ $equiv 7 pmod 8$ is $2n$ ($n$ is even)?



I tried some examples and find that $x^2-pcdot y^2=2(-1)^n$ appears in the half of the period $- 1$ where $x$ and $y$ are its convergent, for instance continued fraction of $sqrt p$ is $[a_0 ; a_1,a_2,cdotcdotcdot,a_n]$, then $p_{frac n 2 -1}$ and $q_{frac n 2 -1}$ satisfies the equation $x^2-pcdot y^2=2(-1)^n$ where $x=p_{frac n 2 -1}$ and $y=q_{frac n 2-1}$.



I recall that Legendre symbol $left(displaystyle frac {~2~}{~p~}right)$ is $1$ when $p equiv 7 pmod 8$ while $left(displaystyle frac {~2~}{~p~}right)$ is $-1$ when $p equiv 3 pmod 8$, but cannot figure it out how I can relate them.



Is this the right way to approach?










share|cite|improve this question




















  • 1




    Can you give any reference for the fact you gave in first line?
    – Seewoo Lee
    Feb 9 '17 at 15:20










  • @See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
    – sibilant
    Feb 27 at 21:03















up vote
3
down vote

favorite
2









up vote
3
down vote

favorite
2






2





It is known that the period of continued fraction of a prime $sqrt p$ is odd if and only if $p equiv 1 pmod 4$. So when $p equiv 3 pmod 4$, the period is even.



But how do I prove the period of continued fraction of $sqrt p$ where $p$ $equiv 3 pmod 8$ is $2n$ ($n$ is odd) while the period of continued fraction of $sqrt p$ where $p$ $equiv 7 pmod 8$ is $2n$ ($n$ is even)?



I tried some examples and find that $x^2-pcdot y^2=2(-1)^n$ appears in the half of the period $- 1$ where $x$ and $y$ are its convergent, for instance continued fraction of $sqrt p$ is $[a_0 ; a_1,a_2,cdotcdotcdot,a_n]$, then $p_{frac n 2 -1}$ and $q_{frac n 2 -1}$ satisfies the equation $x^2-pcdot y^2=2(-1)^n$ where $x=p_{frac n 2 -1}$ and $y=q_{frac n 2-1}$.



I recall that Legendre symbol $left(displaystyle frac {~2~}{~p~}right)$ is $1$ when $p equiv 7 pmod 8$ while $left(displaystyle frac {~2~}{~p~}right)$ is $-1$ when $p equiv 3 pmod 8$, but cannot figure it out how I can relate them.



Is this the right way to approach?










share|cite|improve this question















It is known that the period of continued fraction of a prime $sqrt p$ is odd if and only if $p equiv 1 pmod 4$. So when $p equiv 3 pmod 4$, the period is even.



But how do I prove the period of continued fraction of $sqrt p$ where $p$ $equiv 3 pmod 8$ is $2n$ ($n$ is odd) while the period of continued fraction of $sqrt p$ where $p$ $equiv 7 pmod 8$ is $2n$ ($n$ is even)?



I tried some examples and find that $x^2-pcdot y^2=2(-1)^n$ appears in the half of the period $- 1$ where $x$ and $y$ are its convergent, for instance continued fraction of $sqrt p$ is $[a_0 ; a_1,a_2,cdotcdotcdot,a_n]$, then $p_{frac n 2 -1}$ and $q_{frac n 2 -1}$ satisfies the equation $x^2-pcdot y^2=2(-1)^n$ where $x=p_{frac n 2 -1}$ and $y=q_{frac n 2-1}$.



I recall that Legendre symbol $left(displaystyle frac {~2~}{~p~}right)$ is $1$ when $p equiv 7 pmod 8$ while $left(displaystyle frac {~2~}{~p~}right)$ is $-1$ when $p equiv 3 pmod 8$, but cannot figure it out how I can relate them.



Is this the right way to approach?







number-theory prime-numbers continued-fractions






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 21 at 11:49









amWhy

191k27223438




191k27223438










asked Dec 5 '16 at 10:34









lmatz

163




163








  • 1




    Can you give any reference for the fact you gave in first line?
    – Seewoo Lee
    Feb 9 '17 at 15:20










  • @See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
    – sibilant
    Feb 27 at 21:03
















  • 1




    Can you give any reference for the fact you gave in first line?
    – Seewoo Lee
    Feb 9 '17 at 15:20










  • @See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
    – sibilant
    Feb 27 at 21:03










1




1




Can you give any reference for the fact you gave in first line?
– Seewoo Lee
Feb 9 '17 at 15:20




Can you give any reference for the fact you gave in first line?
– Seewoo Lee
Feb 9 '17 at 15:20












@See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
– sibilant
Feb 27 at 21:03






@See-WooLee: It looks like a proof of the hard direction (if p is 1 mod 4, then the period is odd) follows from a theorem of Rippon and Taylor in mathstat.dal.ca/FQ/Papers1/42-2/quartrippon02_2004.pdf; they also reference that the result appears in an earlier paper in German by Perron from the 50s.
– sibilant
Feb 27 at 21:03

















active

oldest

votes











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
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2044705%2fparity-of-period-of-continued-fraction-of-square-root-of-prime-number-p%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2044705%2fparity-of-period-of-continued-fraction-of-square-root-of-prime-number-p%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen