Few years ago, one of my friends find that $\sqrt{p}$ has periodic continued fraction with odd (resp. even) period iff $p\equiv 1(mod 4)$ (resp. $p\equiv 3(mod 4)$) for a prime $p$. (You can observe this in here : http://oeis.org/search?q=1%2C2%2C1%2C2%2C4%2C2%2C1%2C2%2C2%2C5%2C4%2C2%2C1%2C2%2C6%2C2&language=english&go=Search). However, I don't know any clues to prove this. He told that it may be related to Pell's equation. Do you have any ideas?
2026-03-27 14:55:13.1774623313
Period of continued fraction of $\sqrt{p}$
559 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- Show that $(x,y,z)$ is a primitive Pythagorean triple then either $x$ or $y$ is divisible by $3$.
- About polynomial value being perfect power.
- Name of Theorem for Coloring of $\{1, \dots, n\}$
- Reciprocal-totient function, in term of the totient function?
- What is the smallest integer $N>2$, such that $x^5+y^5 = N$ has a rational solution?
- Integer from base 10 to base 2
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
Related Questions in ELEMENTARY-NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- How do I show that if $\boldsymbol{a_1 a_2 a_3\cdots a_n \mid k}$ then each variable divides $\boldsymbol k $?
- Using only the digits 2,3,9, how many six-digit numbers can be formed which are divisible by 6?
- Algebra Proof including relative primes.
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
- algebraic integers of $x^4 -10x^2 +1$
- What exactly is the definition of Carmichael numbers?
- Number of divisors 888,888.
Related Questions in CONTINUED-FRACTIONS
- Formula for the simple reapeted infinitely continued fractions
- Infinite continued fractions and convergents
- Convergence of $\ln\frac{x}{\ln\frac{x}{\ln x...}}$
- Find $\frac{a}{b} \in \mathbb{Q}$ such that $ |\,\frac{a}{b} - \sqrt{2}|_3 < \epsilon $
- $\sqrt{\frac{\pi e}{2}}=\frac{1}{1+\mathrm{K}_{i=1}^{\infty}{\frac{i}{1}}}+\sum_{n=0}^{\infty}{\frac{1}{(2n+1)!!}}$ implies $\sqrt{\pi e/2}\notin Q$?
- is there an algorithm that generates the continued fraction of a product of convergent continued fractions?
- continued fraction of $\sqrt{41}$
- Fundamental solution to specific Pell equation
- Continued fraction of binomial function $(1+z)^{1/4}$
- How does the convergence sector of a continued fraction depend on the order where it is truncated?
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Yes. If prime $p \equiv 1 \pmod 4,$ there are both (nontrivial) solutions to $x^2 - p y^2 = 1$ and $u^2 - p v^2 = -1.$ If you keep track of the "convergents" $\frac{a}{b}$ while finding the continued fraction, you will actually find $a^2 - p b^2 = -1$ along the way, about halfway.
13
$$ \small \begin{array}{cccccccccccccccccccccccccccccc} & & 3 & & 1 & & 1 & & 1 & & 1 & & 6 & & 1 & & 1 & & 1 & & 1 & & 6 & \\ \frac{0}{1} & \frac{1}{0} & & \frac{3}{1} & & \frac{4}{1} & & \frac{7}{2} & & \frac{11}{3} & & \frac{18}{5} & & \frac{119}{33} & & \frac{137}{38} & & \frac{256}{71} & & \frac{393}{109} & & \frac{649}{180} & & \frac{4287}{1189} \\ \\ & 1 & & -4 & & 3 & & -3 & & 4 & & -1 & & 4 & & -3 & & 3 & & -4 & & 1 & & -4 \end{array} $$
29
$$ \sqrt {29} $$
$$ \scriptsize \begin{array}{cccccccccccccccccccccccccccccc} & & 5 & & 2 & & 1 & & 1 & & 2 & & 10 & & 2 & & 1 & & 1 & & 2 & & 10 & \\ \frac{0}{1} & \frac{1}{0} & & \frac{5}{1} & & \frac{11}{2} & & \frac{16}{3} & & \frac{27}{5} & & \frac{70}{13} & & \frac{727}{135} & & \frac{1524}{283} & & \frac{2251}{418} & & \frac{3775}{701} & & \frac{9801}{1820} & & \frac{101785}{18901} \\ \\ -29 & 1 & & -4 & & 5 & & -5 & & 4 & & -1 & & 4 & & -5 & & 5 & & -4 & & 1 & & -4 \end{array} $$
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
THEOREM 1: With prime $p \equiv 1 \pmod 4,$ there is always a solution to $$ x^2 - p y^2 = -1 $$ in integers. The proof is from Mordell, Diophantine Equations, pages 55-56.
PROOF: Take the smallest integer pair $T>1,U >0$ such that $$ T^2 - p U^2 = 1. $$ We know that $T$ is odd and $U$ is even. So, we have the integer equation $$ \left( \frac{T+1}{2} \right) \left( \frac{T-1}{2} \right) = p \left( \frac{U}{2} \right)^2. $$
We have $$ \gcd \left( \left( \frac{T+1}{2} \right), \left( \frac{T-1}{2} \right) \right) = 1. $$ Indeed, $$ \left( \frac{T+1}{2} \right) - \left( \frac{T-1}{2} \right) = 1. $$
There are now two cases, by unique factorization in integers:
$$ \mbox{(A):} \; \; \; \left( \frac{T+1}{2} \right) = p a^2, \; \; \left( \frac{T-1}{2} \right) = b^2 $$
$$ \mbox{(B):} \; \; \; \left( \frac{T+1}{2} \right) = a^2, \; \; \left( \frac{T-1}{2} \right) = p b^2 $$
Now, in case (B), we find that $(a,b)$ are smaller than $(T,U),$ but $T \geq 3, a > 1,$ and $a^2 - p b^2 = 1.$ This is a contradiction, as our hypothesis is that $(T,U)$ is minimal.
As a result, case (A) holds, with evident $$p a^2 - b^2 = \left( \frac{T+1}{2} \right) - \left( \frac{T-1}{2} \right) = 1, $$ so $$ b^2 - p a^2 = -1. $$
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
THEOREM 2: With primes $p \neq q,$ with $p \equiv q \equiv 1 \pmod 4$ and Legendre $(p|q)=(q|p) = -1,$ there is always a solution to $$ x^2 - pq y^2 = -1 $$ in integers. The proof is from Mordell, Diophantine Equations, pages 55-56.
PROOF: Take the smallest integer pair $T>1,U >0$ such that $$ T^2 - pq U^2 = 1. $$ We know that $T$ is odd and $U$ is even. So, we have the integer equation $$ \left( \frac{T+1}{2} \right) \left( \frac{T-1}{2} \right) = pq \left( \frac{U}{2} \right)^2. $$
We have $$ \gcd \left( \left( \frac{T+1}{2} \right), \left( \frac{T-1}{2} \right) \right) = 1. $$
There are now four cases, by unique factorization in integers:
$$ \mbox{(1):} \; \; \; \left( \frac{T+1}{2} \right) = a^2, \; \; \left( \frac{T-1}{2} \right) = pq b^2 $$
$$ \mbox{(2):} \; \; \; \left( \frac{T+1}{2} \right) = p a^2, \; \; \left( \frac{T-1}{2} \right) = q b^2 $$ $$ \mbox{(3):} \; \; \; \left( \frac{T+1}{2} \right) = q a^2, \; \; \left( \frac{T-1}{2} \right) = p b^2 $$ $$ \mbox{(4):} \; \; \; \left( \frac{T+1}{2} \right) = pq a^2, \; \; \left( \frac{T-1}{2} \right) = b^2 $$
Now, in case (1), we find that $(a,b)$ are smaller than $(T,U),$ but $T \geq 3, a > 1,$ and $a^2 - pq b^2 = 1.$ This is a contradiction, as our hypothesis is that $(T,U)$ is minimal.
In case $(2),$ we have $$ p a^2 - q b^2 = 1. $$ $$ p a^2 \equiv 1 \pmod q, $$ so $a$ is nonzero mod $q,$ then $$ p \equiv \left( \frac{1}{a} \right)^2 \pmod q. $$ This contradicts the hypothesis $(p|q) = -1.$
In case $(3),$ we have $$ q a^2 - p b^2 = 1. $$ $$ q a^2 \equiv 1 \pmod p, $$ so $a$ is nonzero mod $p,$ then $$ q \equiv \left( \frac{1}{a} \right)^2 \pmod p. $$ This contradicts the hypothesis $(q|p) = -1.$
As a result, case (4) holds, with evident $$pq a^2 - b^2 = \left( \frac{T+1}{2} \right) - \left( \frac{T-1}{2} \right) = 1, $$ so $$ b^2 - pq a^2 = -1. $$
$$ \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc \bigcirc $$
Caution: With primes $p \neq q,$ with $p \equiv q \equiv 1 \pmod 4$ and Legendre $(p|q)=(q|p) = 1,$ there may not be a solution to $$ x^2 - pq y^2 = -1 $$ For example, $205 = 5 \cdot 41$ and $221 = 13 \cdot 17.$ Below is the Lagrange-Gauss method for the continued fraction. No decimal accuracy is needed, no memory used in the computer.
==========================================================