#A112 INTEGERS 25 (2025)
INTEGER SOLUTIONS OF PELL EQUATION IN A CLOSED
ROTATED SQUARE REGION
Kun Yi Ong
Depa men o Ma hema ical Sciences, Facul y o Science and Technology,
Uni e si i Kebangsaan Malaysia, Bangi, Selango , Malaysia
[email p o ec ed]
Eddie Shah il Bin Ismail
Depa men o Ma hema ical Sciences, Facul y o Science and Technology,
Uni e si i Kebangsaan Malaysia, Bangi, Selango , Malaysia
[email p o ec ed]
Recei ed: 3/25/25, Re ised: 10/19/25, Accep ed: 11/15/25, Published: 11/25/25
Abs ac
The Pell equa ion x2−Dy2= 1 wi h non-squa e D > 1 has in ini ely many in ege
solu ions, ye mos esea ch has cen e ed on he asymp o ic beha io o undamen al
uni s as D a ies. By con as , he exac dis ibu ion o solu ions o a ixed D
wi hin bounded egions has ecei ed li le a en ion. In his pape , we con ibu e o
his di ec ion by gi ing an explici enume a ion o all solu ions o he Pell equa ion
inside he squa e |x|+|y|≤λ o any λ > 0. We u he ex end ou esul s o he
shi ed Pell equa ion (x−a)2−D(y−b)2= 1 o in ege s aand b, ob aining exac
coun s o su icien ly la ge λ.
1. In oduc ion
Le Dbe a non-squa e posi i e in ege . The Pell equa ion is he Diophan ine
equa ion
x2−Dy2= 1 (1.1)
whose solu ions a e in ege pai s (x, y) sa is ying (1.1). I s his o y da es back o
he ancien G eeks, including A chimedes’ Ca le P oblem (see [5, 6, 13]) and o
he wo k o B ahmagup a and Bhaska a in India, as well as Fe ma and Eule in
Eu ope. I was Lag ange who inally es ablished he undamen al ac ha Pell
equa ion (1.1) possesses in ini ely many in ege solu ions. P oo s o his esul can
be ound in nume ous books and a icles on numbe heo y, see o example [2,4,10].
DOI: 10.5281/zenodo.17711743
INTEGERS: 25 (2025) 2
The posi i e solu ion (x, y)∈N2wi h he smalles alue o x+y√Damong hem
is called he undamen al solu ion and is deno ed by (α, β). In pa icula , i can be
de e mined by
α+β√D= in nx+y√D: (x, y)∈Z2, x2−Dy2= 1, x +y√D > 1o.
The ollowing well-known esul desc ibes he se o in ege solu ions o Equa ion
(1.1) (see [1,8–12,14]).
P oposi ion 1.1. Le FDbe de ined as he se o all in ege solu ions o (1.1), i.e.,
FD:= (x, y)∈Z2:x2−Dy2= 1.(1.2)
Then
FD=[
i,j∈{1,−1}(iun, j n)∈Z2:n∈Z≥0,
whe e unand na e in ege s gi en by un+ n√D=α+β√Dn
o all in ege s
n≥0.
De ine unc ions u: [0,∞)→[1,∞) and : [0,∞)→[0,∞) by
u(x) := 1
2nα+β√Dx
+α−β√Dxo(1.3)
(x) := 1
2√Dnα+β√Dx
−α−β√Dxo(1.4)
whe e (α, β) is he undamen al solu ion. We now s a e an al e na i e esul o
P oposi ion 1.1 desc ibing he se o in ege solu ions o Equa ion (1.1) in e ms o
he unc ions uand .
P oposi ion 1.2 ([3]).Conside he unc ions uand as de ined in (1.3) and
(1.4), espec i ely. Then u(n) = unand (n) = n o all in ege s n≥0, whe e un
and na e in ege s as desc ibed in P oposi ion 1.1. This implies
FD=[
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈Z≥0.
Much o he li e a u e has ocused on he g ow h o he undamen al uni εD:=
α+β√Dassocia ed wi h he undamen al solu ion (α, β) as he in ege D a ies.
Fo example, in 2011 Fou y and Jou e [7] p o ed ha he se o pa ame e s D≤x
o which log εDis la ge han D1
4has a ca dinali y essen ially la ge han x1
4log2x.
Mo e ecen ly, Xi [15] es ablished uni o m lowe bounds o he coun ing unc ion
S (x, α) := n(εD, D):2≤D≤x, D =□, εD≤D1
2+αo,
INTEGERS: 25 (2025) 3
p o ing ha o any ixed α∈1
2,1,S (x, α)≫√xlog2xas x→+∞. These
wo ks emphasize he asymp o ic dis ibu ion o he undamen al uni as D a ies.
By con as , compa a i ely li le a en ion has been gi en o he case whe e Dis
ixed and one s udies he exac enume a ion o in ege solu ions in bounded egions
o he plane. To ou knowledge, his p oblem has no been in es iga ed in he
li e a u e.
2. Main Resul s
Conside he unc ions uand as de ined in (1.3) and (1.4), espec i ely. De ine
he unc ion : [0,∞)→[1,∞)by := u+ . Since uand a e s ic ly inc easing
and unbounded, and since u(0) + (0) = 1, i ollows ha is bijec i e and s ic ly
inc easing. The e o e, we may de ine g: [1,∞)→[0,∞) as he in e se unc ion o
, namely g:= −1, which is also bijec i e and s ic ly inc easing.
In his pape , we s udy he se o in ege solu ions o Equa ion (1.1), whe e D
is a ixed non-squa e posi i e in ege , lying in he squa e |x|+|y|≤λwi h λ > 0.
Fo any se G⊆Z2and any eal numbe λ > 0, we de ine
QG(λ) := {(x, y)∈G:|x|+|y|≤λ}.
We now add ess he p oblem o enume a ing he se QFD(λ). As i u ns ou ,
he ollowing esul holds.
Theo em 2.1. Conside he se FDas de ined in (1.2). Then o any eal numbe
λ>0,
QFD(λ) =
∅i λ < 1
[
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈Z≥0, x ≤g(λ)i λ≥1,
whe e g= −1, =u+ . This implies
|QFD(λ)|=(0i λ < 1
2+4⌊g(λ)⌋i λ≥1.
P oo . The case o λ < 1 is i ial, hence assume ha λ≥1. By P oposi ion 1.2,
QFD(λ) = [
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈Z≥0,|iu(x)|+|j (x)|≤λ
=[
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈Z≥0, (x)≤λ,
INTEGERS: 25 (2025) 4
whe e =u+ . Since gis s ic ly inc easing, (x)≤λimplies x≤g(λ) and he
o mula o QFD(λ) ollows.
Fo he numbe o elemen s, |QFD(λ)|, he case o λ<1 is ob ious. Fo λ≥1,
QFD(λ) = [
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈Z≥0, x ≤g(λ)
={(1,0),(−1,0)}∪ [
i,j∈{1,−1}(iu(x), j (x)) ∈Z2:x∈N, x ≤ ⌊g(λ)⌋,
which implies |QFD(λ)|= 2 + 4 ⌊g(λ)⌋.
Based on Theo em 2.1, i is na u al o ask whe he he e exis s an explici o mula
o he unc ion g(λ), whe e λ≥1. This will be add essed in he ollowing esul .
Theo em 2.2. Conside he unc ions uand as de ined in (1.3) and (1.4), e-
spec i ely. Le =u+ and g= −1. Then o any eal numbe x≥1,
g(x) = 1
log α+β√Dcosh−1 Dx −√Dx2−D+ 1
D−1!,(2.1)
whe e cosh−1is he in e se cosh unc ion. Equi alen ly,
g(x)
=
log
Dx −√Dx2−D+ 1 + √Dq(D+ 1) x2−D+ 1 −2x√Dx2−D+ 1
D−1
log α+β√D.
(2.2)
P oo . We begin wi h he unc ion : [0,∞)→[1,∞), =u+ :
(x)
=1
2nα+β√Dx
+α−β√Dxo+1
2√Dnα+β√Dx
−α−β√Dxo
=1
2α+β√Dx
+α+β√D−x+1
2√Dα+β√Dx
−α+β√D−x
=1
2nelog(α+β√D)x+e−log(α+β√D)xo+1
2√Dnelog(α+β√D)x−e−log(α+β√D)xo
= cosh log α+β√Dx+1
√Dsinh log α+β√Dx.
Fo simplici y, le y= log α+β√Dx. Then
(x) = cosh y+1
√Dsinh y= cosh y+1
√Dqcosh2y−1,
INTEGERS: 25 (2025) 5
which implies
√D( (x)−cosh y) = qcosh2y−1.(2.3)
By squa ing bo h sides o Equa ion (2.3) and ea anging he e ms in cosh y, we
ob ain he quad a ic equa ion
(D−1) cosh2y−(2D (x)) cosh y+D( (x))2+ 1= 0.
Applying he quad a ic o mula gi es
cosh y=
2D (x)± (2D (x))2−4 (D−1) D( (x))2+ 1
2 (D−1)
=D (x)±qD( (x))2−D+ 1
D−1.(2.4)
He e he symbol ±deno es ei he he plus (+) o minus (−) sign. Subs i u ing
x= 0 in o (2.4), we ind
1 = D±√D−D+ 1
D−1=D±1
D−1,
which shows ha he minus sign mus be chosen. Subs i u ing back
y= log α+β√Dxin o (2.4) and sol ing o x, we ob ain
x=1
log α+β√Dcosh−1
D (x)−qD( (x))2−D+ 1
D−1
.
Finally, eplacing xwi h g(x) := −1(x), we ob ain (2.1).
To ob ain (2.2), we s a om (2.1) and use he iden i y
cosh−1x= log x+√x2−1. In pa icula , o any x≥1,
cosh−1 Dx −√Dx2−D+ 1
D−1!
= log
Dx −√Dx2−D+ 1
D−1+
u
u
Dx −√Dx2−D+ 1
D−1!2
−1
= log
Dx −√Dx2−D+ 1 + qDx −√Dx2−D+ 12−(D−1)2
D−1
INTEGERS: 25 (2025) 6
and
Dx −pDx2−D+ 12−(D−1)2
=qD2x2+Dx2−D+ 1 −2DxpDx2−D+ 1 −D2+ 2D−1
=√Dq(D+ 1) x2−D+ 1 −2xpDx2−D+ 1.
Exp ession (2.2) is a he complica ed. F om Theo em 2.1, we obse e ha he
o mula o QFD(λ) emains alid i we eplace he unc ion g(λ) wi h ⌊g(λ)⌋. This
obse a ion mo i a es us o ask whe he he e exis s a simple explici o mula o
he unc ion ⌊g(x)⌋compa ed o he o iginal exp ession o g(x) gi en in (2.2). I
u ns ou ha he answe is yes, as we will desc ibe in he ollowing heo em.
Theo em 2.3. Le gbe he unc ion as desc ibed in Theo em 2.2. Then o any
eal numbe x≥1,
⌊g(x)⌋=
log (⌊x⌋)+C
log α+β√D
,(2.5)
whe e C= log 2√D
1 + √D!is a posi i e eal cons an . Mo e p ecisely, he e exis s
a bounded unc ion µ(x) : [1,∞)→[0,1) which anishes p ecisely a he poin s
(0), (1), (2), . . ., and sa is ies
g(x) =
log (⌊x⌋)+C
log α+β√D
+µ(x) (2.6)
o all x≥1.
P oo . We ha e he unc ion : [0,∞)→[1,∞) as
(x)
=1
2nα+β√Dx
+α−β√Dxo+1
2√Dnα+β√Dx
−α−β√Dxo
=1 + √D
2√Dα+β√Dx
+√D−1
2√Dα−β√Dx
.
Since 0 <√D−1
2√D<1 and 0 <α−β√Dx
=α+β√D−x
≤1, we ha e
0<√D−1
2√Dα−β√Dx
<1.
INTEGERS: 25 (2025) 7
This implies ha (x)−1<1 + √D
2√Dα+β√Dx
< (x) and hence
2√D
1 + √D( (x)−1) <α+β√Dx
<2√D
1 + √D( (x)) .(2.7)
Focusing on he igh -hand side o (2.7), subs i u ing xwi h ⌊x⌋and hen aking
loga i hms, we ob ain
⌊x⌋<log ( (⌊x⌋))+C
log α+β√D(2.8)
whe e C= log 2√D
1 + √D!. Since is s ic ly inc easing, we ha e (x)≥ (⌊x⌋).
Because (⌊x⌋)∈Z, i ollows ha ⌊ (x)⌋≥ (⌊x⌋). The e o e, (2.8) becomes
⌊x⌋<log (⌊ (x)⌋)+C
log α+β√D.(2.9)
On he o he hand, ocusing on he le -hand side o (2.7), subs i u ing xwi h
⌊x⌋+ 1 and hen aking loga i hms, we ob ain
⌊x⌋+ 1 >log ( (⌊x⌋+ 1) −1)+C
log α+β√D(2.10)
whe e C= log 2√D
1 + √D!. Since is s ic ly inc easing, (⌊x⌋+ 1) > (x)≥
⌊ (x)⌋. Since (⌊x⌋+ 1) and ⌊ (x)⌋a e in ege s, he s ic inequali y (⌊x⌋+ 1) >
⌊ (x)⌋implies (⌊x⌋+ 1) ≥ ⌊ (x)⌋+ 1. The e o e, (2.10) becomes
⌊x⌋+ 1 >log (⌊ (x)⌋)+C
log α+β√D.(2.11)
By (2.9) and (2.11), we conclude ha
⌊x⌋=
log (⌊ (x)⌋)+C
log α+β√D
.
Finally, eplacing xwi h g(x) := −1(x), we ob ain (2.5).
Since Equa ion (2.6) ollows om Equa ion (2.5), i emains o show ha µ(x) =
0 i and only i x∈ { (0), (1), (2), . . .}. Fi s suppose ha µ(x) = 0. Then by
(2.6), we ha e g(x) = −1(x)∈Z≥0, which implies ha x∈ { (0), (1), (2), . . .}.
Con e sely, i x∈ { (0), (1), (2), . . .}, hen g(x)∈Z≥0. By (2.6), i ollows ha
µ(x) = 0.
INTEGERS: 25 (2025) 8
By combining Theo em 2.1 and Theo em 2.3, we may conclude he ollowing
consequence.
Co olla y 2.4. Conside he se FDas de ined in (1.2). Then o any eal numbe
λ>0,
QFD(λ) =
∅i λ<1
[
i,j∈{1,−1}
(iu(x), j (x)) ∈Z2:x∈Z≥0, x ≤
log (⌊λ⌋)+C
log α+β√D
i λ≥1,
whe e C= log 2√D
1 + √D!is a posi i e eal cons an . This implies
|QFD(λ)|=
0i λ<1
2+4
log (⌊λ⌋)+C
log α+β√D
i λ≥1.
3. Fu he Resul s
The Pell equa ion (1.1) can be w i en as (x−0)2−D(y−0)2= 1, which is he
Pell equa ion cen e ed a he o igin. Mo e gene ally, o any ixed a, b ∈Z, we
conside he shi ed Pell equa ion,
(x−a)2−D(y−b)2= 1.(3.1)
As an analogue o (1.2), we de ine he se F(a,b)
Das he se o in ege solu ions o
Equa ion (3.1), i.e.,
F(a,b)
D:= n(x, y)∈Z2: (x−a)2−D(y−b)2= 1o.(3.2)
Then, by P oposi ion 1.2, we ob ain he esul
F(a,b)
D=[
i,j∈{1,−1}(iu(x)+a, j (x) + b)∈Z2:x∈Z≥0,(3.3)
whe e uand a e he unc ions as de ined in (1.3) and (1.4), espec i ely. Simila ly
o he case o in ege solu ions, he se o eal solu ions o Equa ion (3.1) is gi en
by
[
i,j∈{1,−1}(iu(x)+a, j (x) + b)∈R2:x∈R, x ≥0.(3.4)
INTEGERS: 25 (2025) 9
Fo simplici y, deno e each eal solu ion in he se (3.4) by
Ri,j(x) := (iu(x) + a, j (x)+b).(3.5)
No ice ha he x-in e cep s and y-in e cep s o Equa ion (3.1) a e
a±√1+Db2,0and 0, b ± a2−1
D!, espec i ely ( he e is no y-in e cep i
a= 0).
Fo any k∈ {1,2,3,4}, le Hkdeno e he se o all eal pai s in he k- h quad an
o he eal plane, including he bounda y axes. The ollowing p oposi ion desc ibes
he loca ion o he eal solu ions Ri,j(x) in he eal plane o all su icien ly la ge
x≥0.
P oposi ion 3.1. Le Ri,j (x)be a eal solu ion as de ined in (3.5). Then R1,1(x)∈
H1,R−1,1(x)∈ H2,R1,−1(x)∈ H3, and R−1,−1(x)∈ H4 o all su icien ly la ge
x≥0.
P oo . We p o e his o a, b ≥0, as he p oo s when a<0 o b<0 a e e y
simila . I ollows ha R1,1(x)∈ H1 o all x∈[0,∞). Fo he case o a>0, he e
exis x-in e cep s and y-in e cep s o he Equa ion (3.1). In pa icula , he e exis
p, q, ∈[0,∞) such ha
1. R−1,1(p) = 0, b + a2−1
D!∈ H2,
2. R−1,−1(q) =
0, b − a2−1
D!i 0, b − a2−1
D!∈ H3
a−√1+Db2,0i a−√1+Db2,0∈ H3, and
3. R1,−1( ) = a+√1+Db2,0∈ H4.
Since he unc ions uand a e s ic ly inc easing, his implies ha R−1,1(x)∈ H2
o all x∈[p, ∞), ha R−1,−1(x)∈ H3 o all x∈[q, ∞), and R1,−1(x)∈ H4 o
all x∈[ , ∞).
Fo he case o a= 0, we ha e R−1,1(x)∈ H2 o all x∈[0,∞). The e exis
x-in e cep s (bu no y-in e cep ) o he Equa ion (3.1). By simila a gumen , he e
exis q, ∈[0,∞) such ha R−1,−1(x)∈ H3 o all x∈[q, ∞) and R1,−1(x)∈ H4
o all x∈[ , ∞).
The ollowing p oposi ion helps es ablish he se ing o Theo em 3.3.
P oposi ion 3.2. Le a= 0. Then
|a|+p1+Db2= max (a±p1+Db2,
b± a2−1
D).