Content uploaded by Sam Northshield
Author content
All content in this area was uploaded by Sam Northshield on Dec 16, 2022
Content may be subject to copyright.
SOME GENERALIZATIONS OF A FORMULA OF REZNICK
SAM NORTHSHIELD
Abstract. In 2008, Reznick published a formula for the statistical behavior of Stern’s se-
quence modulo m. We reprove this result and, using it, prove similar results for other se-
quences.
1. Introduction
For a given integer sequence (xn), we define its distribution modulo mas the numbers
P(a, m) := lim
N→∞
1
N|{n≤N:xn≡amod m}|.(1.1)
These limits, of course, do not necessarily exist in which case we say that (xn) has no distri-
bution modulo m. A good reference for this topic is the last chapter of [10]. It is easy to see
that in the special case where (xn) is periodic these numbers do exist (for all m). For example,
for a fixed m, (Fn, Fn+1) mod mhas only finitely many possible values and so is eventually
periodic for all m(in fact periodic since the map (a, b)7→ (b, a +b) is invertible). More is
known about the distribution of the Fibonacci sequence: Niederreiter [13] has shown that if
mis a power of 5 then the distribution is uniform (i.e., P(a, m) = P(b, m) for all a, b) modulo
m; Kuipers and Shiu [11] have shown the converse.
For non-periodic sequences, other techniques must be used. In 2006, Reznick [19] showed
that Stern’s sequence, defined by a1= 1, a2n=an,a2n+1 =an+an+1, has distribution
P(a, m) = 1
mY
p|m
p2
p2−1Y
p|(a,m)
p−1
p.(1.2)
We shall give a new proof of this fact [Theorem 3.5] using Markov chains. This technique was
mentioned, but not used, in [19].
A consequence of (1.2) is
P(i, mk) = P(i, m)
mk−1.(1.3)
From this we prove that, for all m,an
mis uniformly distributed modulo mkfor all k[Corollary
3.6].
In [16], an analogue (bn) of Stern’s sequence, using x⊕y=x+y+√1+4xy instead of
x+yin its definition, was introduced:
b1= 0, b2n=bn, b2n+1 =bn⊕bn+1 =bn+bn+1 +p1+4bnbn+1.
Using the identity (Theorem 3.6 of [16])
bk=a2j+1−k·ak−2j,(2j≤k≤2j+1),(1.4)
1
it follows that (bn) has distribution
P(i, m) = 1
mY
p|m
p
p+ 1 Y
p|(i,m)
2 = 2ω((i,m))
ψ(m)(1.5)
where ω(m) is the number of distinct prime divisors of mand ψ(m) is Dedekind’s psi-function
[Theorem 4.2].
For this sequence, (1.3) holds and thus bn
mis uniformly distributed modulo mkfor all k
[Corollary 4.3].
It is easy to see that
P(i, m) = 1
mY
p|(i,m)
f(p)
p−1·Y
p|m
p-(i,m)
1−f(p)
1−p−1(1.6)
where f(p) = 1
p+ 1 and f(p) = 2
p+ 1 for the distributions of (an) and (bn) respectively. The
arguments for Corollaries 3.6 and 4.3 carry over to any sequence with distribution of the form
(1.6). Two questions come to mind: What sequences have distribution of the form (1.6)?
What functions f(p) are “represented” by a sequence with distribution (1.6)?
By equation (1.4), it turns out that the values of (bn) are those attained by the quadratic
form Q(x, y) = xy over all the pairs of relatively prime non-negative integers x, y. This points
to our next result: for a primitive integral quadratic form Q(x, y) with discriminant ∆, when
gcd(m, ∆) = 1, the sequence (Q(an, an+1)) has distribution of the form (1.6) where
f(p) =
1 + ∆
p
p+ 1 (1.7)
(here (∆/p) is the usual Legendre symbol when pis odd, and is specially defined when p= 2)
[Theorem 5.4]. Hence xn:= Q(an, an+1) satisfies, for all mrelatively prime to ∆, bxn/mcis
uniform mod mkfor all k[Corollary 5.5].
Lastly, we consider the sequence (Rn) where Rnis the number of ways to represent nas a
sum of distinct Fibonacci numbers. This sequence, though similar to Stern’s sequence, does
not share a distribution of form (1.6). In this case, we show that P(0, m) = 1 for all m
[Theorem 6.3].
I thank my colleague Naveen Somasunderam for suggesting the problem “What is the dis-
tribution of anmod m?”, and Keith Conrad for answering two questions on MathOverflow
that helped complete a proof of Theorem 5.5.
2. Preliminaries
To show the limits
P(a, m) := lim
N→∞
1
N|{n≤N:xn≡amod m}| (2.1)
exist, we rely on the following lemma.
Suppose ck∈ {0,1}for all kand define, for m<n,
A(m, n) := 1
n−m
n
X
k=m+1
ck.(2.2)
2
Lemma 2.1. If Lis a number such that for all > 0there exists some jsuch that A(2jk, 2j(k+
1)) is within of Lfor any k, then limN→∞ A(0, N )exists and equals L.
Proof. For any m, n with m<n,A(2jm, 2jn) is the average of several values of the form
A(2jk, 2j(k+ 1)) and so is itself within of L. If N= 2jm+i, 0 <i<2j, then
A(0, N ) = 2jm
2jm+iA(0,2jm) + i
2jm+iA(2jm, 2jm+i).(2.3)
On the right, the first term is between m
m+1 (L−) and L+while the second term is between
0 and 1
m. For Nlarge enough, A(0, N) is within 2of L. The result follows.
3. Stern’s sequence modulo m
3.1. Stern’s diatomic array and sequence. Stern’s diatomic array, sometimes thought of
as “Pascal’s triangle with memory”, begins thus:
1 1
121
13231
1 4 3 5 2 5 3 4 1
15473857275837451
.................
It is defined recursively: Start with row 1 1. Then, given the nth row, define the next one by
copying the numbers on the nth row but inserting, in each gap, the sum of the two numbers
above.
The numbers in the diatomic array, read like a book (but deleting the right-most column
of 1s), form what is known as Stern’s diatomic sequence which begins (for n= 1,2, . . .):
an= 1,1,2,1,3,2,3,1,4,3,5,2,5,3,4,1,5,4,7,3,8,5,7,2,7,5,8,3,7,4,5,1,6, . . . (3.1)
It is defined recursively by
a1= 1, a2n=an, a2n+1 =an+an+1 (3.2)
See [14] and its references, and sequence A002478 of [17], for information about this excep-
tional, and exceptionally well studied, sequence.
A key result for us is a well-know result (e.g., Theorem 5.1 of [14]).
Proposition 3.1. Every ordered pair of relatively prime positive integers appears exactly once
in the sequence (an, an+1).
3.2. Calkin-Wilf and Stern-Brocot Trees. We introduce a tree that first appeared in
“Recounting the Rationals” [3] by Calkin and Wilf. See also Section 2.2 of [15]. Starting with
1
1, we repeatedly apply the two maps L:a
b7→ a
a+band R:a
b7→ a+b
b.
It is easy to see that if rn:= an/an+1, then for all n
L:rn7→ r2nand R:rn7→ r2n+1.(3.3)
It follows, by Proposition 3.1, that the sequence (rn) is an enumeration of the positive rationals
and that every positive rational appears exactly once on the Calkin-Wilf tree.
We may assign an “address” to each node of a binary rooted tree with a word in {L, R}∗via
the obvious interpretation. For example, in the CW tree, 5/2 is at location LRR and 1/1 is
at location addressed by the “empty word” ∗. We define a new rooted binary tree: to a node
with address ω, assign the value on the CW tree with address ω0, the reverse of the word ω.
3
1
1
2
1
3
1
4
1
3
4
2
3
5
3
2
5
1
2
3
2
5
2
3
5
1
3
4
3
1
4
Figure 1. Calkin-Wilf Tree (or CW Tree).
For example, at node RRL, we assign the value 5/2. This gives a new tree which we will call
the Stern-Brocot tree (equivalent to the Stern-Brocot tree defined in [8], which can be easily
checked).
1
1
1
2
1
3
1
4
2
5
2
3
3
5
3
4
2
1
3
2
4
3
5
3
3
1
5
2
4
1
Figure 2. Stern-Brocot Tree (or SB Tree).
Conflating an address on the CW tree with the value assigned to it, note that if ω1< ω2
then ω1L<ω2Land ω1R < ω2Rand so, for all ω,ω1ω < ω2ω. Since ω1L < 1< ω2Rfor all
ω1, ω2, it follows that, on the SB tree, ωLω1< ωRω2for all ω1, ω2, ω. Therefore, the nth row
of the SB tree is a permutation (in fact, involution) of the nth row of the CW tree that orders
those entries in increasing order.
We may define L0and R0for the SB tree in terms of Stern’s sequence as follows:
L0:am
an7→ a2m−1
a2n+1
and R0:am
an7→ a2m+1
a2n−1
.(3.4)
The nth row of the SB tree is then a2k+1
a2n−2k−1for k= 0,...,2n−1 and therefore the combined
first nrows of the SB tree gives, when written in increasing order, ak
a2n−kfor k= 1,...,2n+1.
Proposition 3.2. The combined first n−1rows of the CW tree are the same as for the SB
tree and give, in terms of Stern’s sequence,
ak
a2n−k
:k= 1,...,2n=ak
ak+1
:k= 1,...,2n.(3.5)
4
3.3. The CW tree mod mand its Markov chain. To get the “CW tree mod m”, we
replace each fraction a
bin the CW tree with the ordered pair (amod m, b mod m). Since
the entries of the CW tree include all of the positive rationals (in lowest terms), the CW tree
mod mhas entries in
Sm:= {(i, j)∈m2: gcd(i, j, m)=1}.(3.6)
The cardinality of Smis thus J2(m), one of the Jordan totient functions. By a known product
formula (see for example Exercise 1.5.2 of [12]), we have
Proposition 3.3. For all m,|Sm|=J2(m) = m2Y
p|m1−1
p2.
Consider assigning probability 1
2to each downward edge of the CW tree mod m. This
creates a Markov chain with state space Sm; here is when m= 3:
Figure 3. Markov chain for S3(with (a, b) replaced by a
b); from [9].
It turns out that every state is equally likely in the long run, independent of the starting
state. This is true in general.
Lemma 3.4. For every starting state, the distribution of (an, an+1) mod mis uniform on
Sm.
Proof. Fix m. By Proposition 2.1, there is a sequence of steps in the Markov chain that goes
from (1,1) to any particular (a, b). Note that, modulo m, the map L: (a, b)7→ (a, a +b) is
invertible (L−1: (a, b)7→ (a, b−a)) and its iterates eventually return to (a, b). Hence L−1=Lk
for some k. The same result holds for R: (a, b)7→ (a+b, b). Hence, there is a sequence of steps
that takes (a, b) to (1,1) and then onto any (c, d) of our choosing. Therefore, it is possible to
get from any state to any other state: the Markov chain is irreducible.
Since L((0, b)) = (0, b), the chain is non-periodic. It follows, by the “Fundamental Theorem
of Markov Chains” (see, for example, [2]), that there exists a unique stationary distribution.
Since Land Rare invertible, every state has a 2 arrows out and 2 arrows in and so the uniform
distribution is stationary. By uniqueness, it is the unique stationary distribution. That is,
no matter what starting point, as napproaches ∞, the distribution becomes uniform. This
implies that for any node on the CW tree, the distribution modulo mof the 2ndescendants
uniformly approaches the uniform distribution.
Example. For the case when m= 3,
0
1,0
2,1
0,1
1,1
2,2
0,2
1,2
2(3.7)
5
become, in the long run, equally likely. The distribution of Stern’s sequence modulo 3 is then
P(0,3) = 1/4 and P(1,3) = P(2,3) = 3/8.
Theorem 3.5. The distribution of Stern’s sequence modulo mis
P(i, m) = 1
mY
p|m
p2
p2−1Y
p|(i,m)
p−1
p.(3.8)
Proof. By Lemma 3.4, the distribution of anmod msatisfies
P(i, m) = |{(k, j)∈Sm:k=i}|/|Sm|.(3.9)
Let g:= gcd(i, m). Since
|{(k, j)∈Sm:k=i}| =|{j∈m: gcd(j, g) = 1}|
=
m/g
[
k=1{j∈ {kg + 1, . . . , kg +g}: gcd(j, g ) = 1
=m
g· {j∈g: gcd(j, g)=1}| =mφ(g)
g=mY
p|g
p−1
p,
the result follows by Proposition 3.3.
3.4. A consequence. Although anmod mis not uniformly distributed, it is, when rounded
down one “digit”.
Corollary 3.6. For all m,an
mis distributed uniformly modulo mkfor all k.
Proof. Note that, by Theorem 3.5, P(i, mk) = P(i, m)/mk−1.
Since an
m≡i(mod mk) if and only if an≡(mi +j) (mod mk+1) for some j∈m, the
distribution of an
mmod mkis
P(i, mk) =
m
X
i=1
P(mj +i, mk+1) =
m
X
i=1
P(i, m)/mk=1
mk.(3.10)
Corollary 3.7. For any prime p,jan
pkis equidistributed in the p-adic integers Zp.
Example. Here are values of ban/10cmod 100, n≥5×105:
19,9,90,61,71,95,23,76,52,90,37,23,85,4,18,51,33,46,13,94,80,8,27,75,47,56,
8,70,61,36,75,89,14,93,79,45,65,82,16,68,51,91,40,28,88,14,26,63,37,72,35,
32,97,56,58,18,60,4,44,27,83,90,6,30,23,25,1,80,78,12,34,89,55,98,43,31, . . .
3.5. The Chinese Remainder Theorem. We note that for any function F:Sm→Z, the
sequence F(an, an+1) mod mhas a distribution. Under rather mild conditions, the distribu-
tion has a multiplicative property.
The Chinese Remainder Theorem states that if m⊥n(i.e., mand nare relatively prime)
then
Z/(m)×Z/(n)∼
=Z/(mn).(3.11)
6
If ∗denotes this isomorphism so that, for example when m= 2, n = 3, 0 ∗0=0,1∗1 =
1,0∗2=2,1∗0=3,0∗1=4,and 1 ∗2 = 5, we have an induced isomorphism
Sm×Sn∼
=Smn,[((i, j ),(u, v)) 7→ (i∗u, j ∗v)].(3.12)
We say that a function F:Z×Z→Zis normal if, for all m,
F(x, y)≡F(xmod m, y mod m) (mod m).(3.13)
Every polynomial in Z[x, y] is normal.
Lemma 3.8. For a normal function F, the sequence F(an, an+1)has distribution satisfying
P(i, m)P(j, n) = P(i∗j, mn).(3.14)
Proof. With isomorphism ∗of (3.12), since
x∗y≡x(mod m) and x∗y≡y(mod n),
F(i∗u, j ∗v)≡F(i, j) (mod m) and F(i∗u, j ∗v)≡F(u, v) (mod n)
and so
F(i∗j, u ∗v)≡F(i, j )∗F(u, v) (mod mn).(3.15)
Hence, the isomorphism of (3.12) is a bijection between ordered pairs ((i, j),(u, v)) of solutions
of F≡a(mod m) and F≡b(mod n) and solutions (i∗u, j ∗v) of F≡a∗b(mod mn).
4. An analogue of Stern’s sequence
4.1. The distribution of anan+1.As in the proof of Theorem 3.5, we’ll use Lemma 3.4 and
a counting argument.
Dedekind’s psi function is defined by ψ(n) = nY
p|n1 + 1
pand satisfies
ψ(n) = φ(n)/J2(n) (4.1)
where, as was noted in Proposition 3.3,
J2(n) = n2Y1−1
p2(4.2)
is one of the Jordan totient functions that is also the cardinality of Sn.
Lemma 4.1. The distribution of (anan+1 )satisfies, for prime powers pn,
P(i, pn) = (2
ψ(pn)if p|i
1
ψ(pn)if p-i.(4.3)
Proof. Consider Spνwith each entry (i, j) replaced by the product ij. For example, applying
this process to S8yields the array
S0
8:=
0 0 0 0
01234567
2 6 2 6
03614725
4 4 4 4
05274163
6 2 6 2
07654321
(4.4)
7
For each unit i(i.e., gcd(i, p) = 1), the corresponding row {ij :j∈pν}is a permutation of
pν, the corresponding column {ji :j∈pν}is a permutation of pν, and the whole of S0
pνis the
union of these unit rows and unit columns.
A particular unit uappears once in each unit row and, since umust be a product of units,
it can only occur at an intersection of a unit row and unit column. Hence uoccurs φ(pν) times
in S0
pν.
A particular non-unit vappears once in each unit row and once in each unit column (but
never at the intersection of a row and a column), and so vmust occur 2φ(pν) times in S0
pν.
The result follows.
Let ω(n) denote the number of distinct prime divisors of nand (i, m) denote the gcd of
i, m. Lemmas 3.8 and 4.1 yield the following theorem.
Theorem 4.2. The distribution of (anan+1 )is
P(i, m) = 2ω((i,m))
ψ(m).(4.5)
An interesting rephrasing of the Riemann hypothesis is based on one involving Robin’s
inequality and ψ– see [18].
Conjecture 4.3. For Nk:= the product of the first kprimes,
P(1, Nk)<π2
6eγNklog log Nk
for all k > 2.(4.6)
4.2. The sequence (bn).For non-negative real numbers a, b, let
a⊕b=a+b+√4ab + 1 (4.7)
We may form a “diatomic array”, as for Stern’s sequence, but using ⊕instead of ordinary
addition:
0 0
010
0 2 1 2 0
0 3 2 6 1 6 2 3 0
04310215612112615210340
. . . . . . . . . . . . . . . . .
.
An analogue of Stern’s sequence is
b1= 0, b2n=bn, b2n+1 =bn⊕bn+1 (4.8)
The sequence begins
0,0,1,0,2,1,2,0,3,2,6,1,6,2,3,0,4,3,10,2,15,6,12,1,12,6,15, ... (4.9)
Although this is an integer sequence (A272569 of [17]), it is hardly clear why it does not take
on irrational values. Its connection with Stern’s sequence, from Theorem 3.6 of [16], explains
why and we state it with the following proposition.
Proposition 4.4. If 2j≤k≤2j+1, then bk=a2j+1 −kak−2j.
8
4.3. The distribution of (bn).It follows, by replacing kby 2j+kin Proposition 4.4, that
if 0 ≤k≤2jthen
b2j+k=a2j−kak.(4.10)
By Proposition 3.2, it follows that the sequence b2j, b2j+1, . . . , b2j+1 −1is an involution of the se-
quence a2ja2j+1, a2j+1a2j+2,...a2j+1−1a2j+1 . Hence, the distribution of (bn) is that of (anan+1 )
(with the important caveat that (bn) has some distribution).
A difficulty we encounter in this case is that the SB tree mod mdoes not represent a Markov
chain: on the SB tree, 3
47→ 5
7,4
5and 3
17→ 5
2,4
1and so, mod 3, 0
17→ 2
1,1
2in the first case, but
0
17→ 1
1,2
2in the second. We may not then proceed as we did for the CW tree.
Let A0:= ( 1 0
1 1 ) and A1:= ( 1 1
0 1 ). It is a fact that A0and A1generate SL2(Z) and therefore,
modulo m, generate SL2(Z/(m)) – see [5]. If ω:= ωnωn−1. . . ω0is a word in {0,1}∗, let
[ω] :=
n
X
i=0
ωi·2iand Aω=Aωn·Aωn−1··· Aω0.(4.11)
For example, [01101] = 1 + 4 + 8 = 13 and A01101 = ( 3 5
4 7 ). Note that the determinant of any
Aωis 1.
The following is easy to prove (and is left as an exercise for the reader). See [14] for a similar
result.
Proposition 4.5. For ωj. . . ω0, and n= [ω],
Aω=an+1 an
a2j−n−1a2j−n.(4.12)
Let M∗denote the anti-transpose of Mand M(x) be the M¨obius transformation defined
by M(i.e., a b
c d ∗= ( d b
c a ) and a b
c d (x) = ax+b
cx+d). Note that if the words ωof length nare
ordered lexicographically, then the nth row of the SB tree coincides with Aω(1) and the nth
row of the CW tree coincides with A∗
ω(1). This of course illustrates a common ground for the
SB and CW trees.
Consider the tree formed by Aω7→ Aω0, Aω1. For each address (i.e. word) α∈ {L, R}∗,
substitute 0 for Land 1 for Rto get a word w(α) in {0,1}∗in Figure 4.
(1 0
0 1 )
(1 1
0 1 )
(1 2
0 1 )
(1 3
0 1 )( 3 2
1 1 )
(2 1
1 1 )
(2 3
1 2 )( 3 1
2 1 )
(1 0
1 1 )
(1 1
1 2 )
(1 2
1 3 )( 2 1
3 2 )
(1 0
2 1 )
(1 1
2 3 )( 1 0
3 1 )
Figure 4. The path A∗→A0→A01 →A011 goes from ( 1 0
0 1 ) to ( 1 2
1 3 ).
Lemma 4.6. If a
bis at address αon the SB tree, then
Aw(α)(1) = a
b.(4.13)
9
Let Gm:= SL2(Z/(m)). Considering the elements of Smas column vectors, the elements
of Gmact on Smby matrix multiplication on the left. For a fixed a, and every ( a
b)∈Sm, it is
clear that A0fixes aand permutes the second coordinates. Hence A0permutes Sm. Similarly,
A1permutes Smas well and, since Gmis generated by A0, A1(since SL2(Z) is – see [5]), every
element of Gmpermutes the elements of Sm. Therefore, if a finite sequence v1, v2, . . . , vkin
Smis nearly uniform (e.g., every P(a, m) is within of 1/m for all a), then so is the sequence
Mv1, M v2, . . . , Mvk.
Asubtree of the SB-tree is the tree containing all vertices with addresses of the form ω0ω
for some fixed ω0(as ωvaries through {L, R}∗).
Consequently, modulo m, as j→ ∞, the jth row in any SB subtree approaches the uniform
distribution uniformly over all ω0. Hence, by Lemma 2.1, we have the following theorem.
Theorem 4.7. The distribution of (bn)is
P(i, m) = 2ω((i,m))
ψ(m).(4.14)
This distribution satisfies equation (1.3) and thus, as in Corollary 3.6, we have the following.
Corollary 4.8. For all mand k > 0, the sequences bn
mand anan+1
mare uniformly dis-
tributed modulo mk.
4.4. Generalizations. It turns out that the two distributions defined above satisfy, for an
appropriate f(p),
P(i, m) = 1
mY
p|(i,m)
f(p)
p−1·Y
p|m
p-(i,m)
1−f(p)
1−p−1.(4.15)
In particular, the distribution of (an) arises when f(p) = 1
p+1 and the distribution of (bn)
arises when f(p) = 2
p+1 .
Every distribution described by equation (4.15) satisfies
P(0, p) = f(p), P (i, p) = P(j, p) whenever p-i, j (4.16)
as well as the conclusion of Lemma 3.8.
It is worth noting that the uniform distribution is when f(p) = 1
p(and a sequence that has
that distribution is, of course, (n)). An interesting question is: “for what functions f(p) is
there a sequence with a distribution given by (4.15)”? For example, f(p) = 1 gives
P(i, m) = (d/m if d|i
0 otherwise (4.17)
where dis the largest square-free divisor of m. The sequences (n!) and (Rn) (the latter of
which is studied later in this paper) have that distribution for square-free monly. Is there a
sequence with this distribution for all m?
5. Quadratic Forms
A binary primitive integral quadratic form is a function of the form
Q(x, y) := Ax2+Bxy +Cy2(5.1)
10
where A, B, C are relatively prime integers. Its discriminant is the quantity
∆ := B2−4AC. (5.2)
For example, Q(x, y) = xy has [A, B , C] = [0,1,0] and thus ∆ = 1.
5.1. The distribution of Q(an, an+1)modulo 2. Let cn:= Q(an, an+1). This sequence has
a distribution; we now find a formula for it. Note that, modulo 8, ∆ ∈ {0,1,4,5}.
Lemma 5.1. The sequence cn:= Q(an, an+1)has distribution satisfying
P(0,2) =
0if ∆≡5 (mod 8)
1/3if ∆≡0or 4 (mod 8)
2/3if ∆≡1 (mod 8).
(5.3)
Proof. Let a, b, c ∈ {0,1}be defined by A= 2α+a,B= 2β+b,C= 2γ+cfor some α, β, γ.
Since Qis primitive, at least one of a, b, c is odd. Then, modulo 8,
∆ = 4(β(β+b)−ac) + b2.(5.4)
Because consecutive values of anare relatively prime, it follows that, modulo 2, (an, an+1)∈
{(0,1),(1,1),(1,0)}. Further, since (an) is periodic (with period 3) modulo 2, the values of
(an, an+1) cycle through {(0,1),(1,1),(1,0)}and therefore cnmod 2 cycles through c, a +b+
c, a.
If ∆ mod 8 is 0 or 4, then bis even, and thus exactly one of c, a +b+c, a is even. If ∆
mod 8 is odd, then b= 1 and, modulo 8, ∆ = 1 + 4ac. If ∆ ≡1 (mod 8), then exactly two of
c, a +b+c, a are even while if ∆ ≡5 (mod 8) then none of c, a +b+c, a are even. The result
follows.
The Legendre symbol is defined, for an odd prime pand integer n, to be
n
p=
1 if n≡x2(mod p) for some x
−1 if n6≡ x2(mod p) for all x
0 if p|n.
(5.5)
It is generally left undefined for p= 2 and, for odd non-prime m, a Jacobi symbol is defined.
We define
∆
2=
1 if ∆ ≡1 (mod 8)
−1 if ∆ ≡5 (mod 8)
0 if 2|∆
(5.6)
and so Lemma 5.1 states that P(i, 2) satisfies (4.15) where
f(p) =
1 + ∆
p
1 + p.(5.7)
We note that for ∆ an odd prime, our ∆
2equals 2
∆(its values often called “the second
supplement of the law of quadratic reciprocity”).
11
5.2. The distribution of Q(an, an+1)modulo p.The proof of this lemma is mostly the
answer, by Keith Conrad, to a question of the author on MathOverflow [7].
Lemma 5.2. The number of solutions in Spof Q(x, y)=0is
(p−1) 1 + ∆
p.(5.8)
If p-∆, then the number of solutions in Spof the equation Q(x, y) = ufor any unit u∈F×
is
p−∆
p.(5.9)
Proof. The case of p= 2 was covered earlier. Let pbe an odd prime and let F:= Z/(p), the
field with pelements. If A=C= 0 then that is equivalent to Q(x, y) = xy dealt with in the
section on (bn). We may assume A6= 0 since, otherwise, we can always switch xand y.
The equation
Ax2+Bux +Cu2= 0 (5.10)
can then, by completing the square, be written as
(2Ax +Bu)2
u2= ∆.(5.11)
If ∆
p= 1, then ∆ = v2for some unit vand so, for every unit uand choice of sign for v,
there is a solution xof (5.11). Hence there are 2(p−1) solutions altogether. If ∆
p=−1,
then ∆ 6=x2for any xand so (5.11) has no solutions. Lastly, if ∆
p= 0 then ∆ = 0 in Zp
and so there is one solution xto (5.11) for each unit uand so there are p−1 solutions to
(5.11) altogether. Equation (5.8) summarizes these three cases.
Suppose now that p-∆ so that ∆
p=±1. We first seek the number of solutions of
Q=uwhere uis a unit and so, since uis arbitrary, we may take A= 1; we thus consider
x2+Bxy +Cy2=uwhere uis a unit.
Set R=F[t]/(t2+Bt +C), a finite ring. The norm map NR/F :R→Fis multiplicative,
and using the basis {1, t}
NR/F (−x+yt) = det −x−Cy
y−x−By=Q(x, y).(5.12)
Therefore the equation x2+Bxy +Cy2=uis the same as NR/F (−x+yt) = ufor x, y ∈
F. On units the norm map NR/F :R×→F×is a group homomorphism, so as with all
homomorphisms between finite groups, all values are taken on an equal number of times.
Thus it remains to show the norm map NR/F :R×→F×is surjective.
Case 1: t2+Bt +Cis irreducible in F[t]. Then Ris a field so R×is cyclic and the norm
map NR/F :R×→F×on the nonzero elements of finite fields is onto (if |F|=qthen |R|=q2
and a generator of R×is mapped to a generator of F×). This corresponds to ∆
p=−1 and,
in this case, |R×|=p2−1 and thus the number of solutions is |ker(NR/F )|=p+ 1 for each
unit.
Case 2: t2+Bt+Cis reducible in F[t]. Write it as (t−r)(t−s). Since B2−4C= (r−s)2, from
B2−4C6= 0 we have r6=s. Then R'F[t]/(t−r)×F[t]/(t−r) and in the basis {(1,0),(0,1)},
the norm mapping has the formula NR/F (x, y) = xy which maps R×=F××F×onto F×.
12
This corresponds to ∆
p= 1 and, in this case, |R×|= (p−1)2and thus the number of
solutions is |ker(NR/F )|=p−1 for each unit.
5.3. The distribution of Q(an, an+1)where m⊥∆.In [6], Theorem 2.1, Conrad proves
the following multi-dimensional Hensel’s lemma.
Lemma 5.3. If |f(a)|p<1and ||(∇f)(a)||p= 1, then there exists some α∈Z2
psuch that
f(α)=0and α≡a(mod p).
Suppose p-∆. Fix z∈Zpand let F(x, y) = Ax2+Bxy +Cy2−(1 +pz).If ||∇F(x, y)||p<1
and gcd(x, y, p) = 1 then pdivides both 2Ax +By and Bx + 2C y. This implies
2A B
B2Cx
y≡0
0(mod p) (5.13)
and thus the determinant of the matrix, B2−4AC, is divisible by p– a contradiction. Hence
||∇F(x, y)||p= 1 whenever gcd(x, y, p) = 1.
Hence, for any solution a∈Spof Q(a) = x(x∈F), there are pν−1solutions of Q(α)≡x
(mod p) in Z/(pν). We have the following lemma.
Lemma 5.4. If pis an odd prime and p-∆, then
P(i, pν) =
1 + ∆
p/ψ(pν)if p|i
p−∆
p/(ψ(pν)(p−1)) if p-i. (5.14)
By Lemma 5.3 and the multiplicative property of ψ(n), we have the following theorem.
Theorem 5.5. For a binary primitive integral quadratic form Qwith discriminant ∆, if
m⊥∆then
P(i, m) = 1
mY
p|(i,m)
f(p)
p−1·Y
p|m
p-(i,m)
1−f(p)
1−p−1(5.15)
where
f(p) =
1 + ∆
p
p+ 1 .(5.16)
Corollary 5.6. For a binary primitive integral quadratic form Q, let xn:= Q(an, an+1). For
all mrelatively prime to ∆,bxn
mcis uniformly distributed modulo mkfor all k.
5.4. Further directions. Curiously, the distribution of the primitive values of Qmodulo
mdepends only on the discriminant of Q(as long as this discriminant and mare relatively
prime). Since non-equivalent quadratic forms take on different values, it seems inevitable that
their distributions will differ modulo mwhen gcd(m, ∆) 6= 1.
As for the section on (bn), the sequence
cn:= Q(a2j+n, a2j+1−n) for 2j≤n≤2j+1 (5.17)
has the same distribution as Q(an, an+1). Furthermore, (cn) will obey the Stern-like recursion
c2n=cn, c2n+1 =cn⊕cn+1 (5.18)
13
if ⊕is defined by
x⊕y=x+y+p4xy + ∆ (5.19)
or, equivalently, when |ad −bc|= 1 then
Q(a+b, c +d) = Q(a, c)⊕Q(b, d).(5.20)
6. Fibonacci Representations
Every integer can be represented in at least one way as a sum of distinct Fibonacci numbers
– see [4].
Let Rndenote the number of ways to represent nas a sum of distinct Fibonacci numbers.
Its generating function thus satisfies
∞
X
n=0
Rnxn=
∞
Y
i=2 1 + xFn.(6.1)
It also has a recursive definition
Rn=X
σ(i)∈{n,n−1}
Ri(6.2)
where σ(n) := jnφ +1
φkis the “Fibonacci shift” (called ρin [16]). This recursion can be
implemented in Maple; here’s for the shifted sequence r(n) = Rn−1:
r := proc(n) option remember; if n <2 then 1; elif sigma(n + 1) - sigma(n) = 2
then r(sigma(n) - n); else r(2*n - 2 - sigma(n - 1)) + r(2*n - 1 - sigma(n - 1)); end
if; end proc
The first few terms of Rnare (for n= 0,1,2, . . .):
1,1,1,2,1,2,2,1,3,2,2,3,1,3,3,2,4,2,3,3,1,4,3,3,5,2,4,4,2,5,3,3,4,1,4,4,3,6, . . . (6.3)
6.1. Words. For a word ω∈ {0,1}∗, let
R(ω) := R[ω]where [ωkωk−1. . . ω0] :=
k
X
i=0
ωiFi+2.(6.4)
We define the set of “Zeckendorf words” as
Z:= 1{0,01}∗(6.5)
and recall that for every positive integer n, there is a unique ω∈Zsuch that [ω] = n. We
define the set of “blockhead words” to be
B:= 1{00,01}∗00.(6.6)
and define
Λ:= {0,010,01010, . . .}= 0{10}∗.(6.7)
Lemma 6.1. For all Ω∈Band ω∈Z∪Λ,
R(Ωω) = R(Ω)R(ω).(6.8)
Proof. For Ω ∈B, if ρis a Fibonacci representation of [Ω] then it must end in 00 or 11. For
ω∈Z∪Λ, if ρ0is a Fibonacci representation of [ω] then it begins with 10 or 01 (and no other
representation starts with 00). Therefore, every representation of [Ωω] is a concatenation of
two words that represent [Ω] and [ω] respectively.
14
6.2. Fibonacci triangle. In Figure 5, a Fibonacci hyperbolic graph (see [14, 16]). with
vertices labeled with words in {0,1}∗, sometimes in multiple ways. On the right are numerical
values assigned in the obvious way. The fact that R3= 2 is illustrated by the two words 011,
100 on the left and 3 on the right.
0 1
00 01 10 11
000 001 010 011 100 111
101 110
0
1
36
45
123
12
0
0
0
0 2 345678910 11
1
Figure 5. Vertices labeled by path, and by number.
Next, we label each square with the Zeckendorf word of its top vertex; Figure 6 is of the
subtree headed by the word representing 3. There, the blockhead words are in boldface and
they are at the head of “blocks” of the form ΩZ∪ΩΛ.
100000 100001 100010 100100 100101 101000 101001
10000 10100
10001 10010
1000 1001
100
Figure 6. Sub-triangle labeled with Zeckendorf representations.
Following the construction of Pascal’s triangle, start with box on top of the Fibonacci
triangle labeled 1 and then fill out according to the rule: for each square of side length
Cφ−n+1, take the sum of the numbers of all adjacent squares of side length Cφ−n. The
subtriangle corresponding to the one in Figure 6 are illustrated in Figure 7. The numbers in
Figure 8 are, of course, just R(ω) for each ωin Figure 7.
A block headed by Ω is characterized in Figure 7, via Lemma 6.1, by having every number
in it a multiple of R(Ω).
6.3. The function g(n).Let g(n) denote the sequence
1,3,4,8,9,11,12,21,22,24, . . . (6.9)
defined by, for i∈ {0,1},
g:
k
X
i=0
i2i7−→
k
X
i=0
iF2i+2.(6.10)
15
11
11
22
2
3223
1 3 3 2 42 3 3 1
Figure 7. A triangle labeled by Rn.
The set {g(n)}is the set of all numbers represented as a sum of distinct even-indexed Fibonacci
numbers (OEIS sequence A054204 [17]). This function also satisfies the recursive definition:
g(1) = 1, g(2n) = g(n) + σ(g(n)), g(2n+ 1) = g(2n) + 1 (6.11)
with σ, the Fibonacci shift, defined above.
The following is an analogue of Theorem 4.1 of [14]
Rn=X
σ(i)+j=n
Ig(N)(i)·Ig(N)(j).(6.12)
The following result, from a paper by Bicknell-Johnson (Theorem 2.1 of [1]), shows that
Stern’s sequence is a subsequence of (R(n)).
Lemma 6.2. For all j,R(g(j)) = aj+1.
Theorem 6.3. For (Rn),P(0, m) = 1 for all m.
Proof. For each blockhead word Ω ∈B, we define a “block” Ω(Z∪Λ) := {Ωω:ω∈Z∪Λ}
and note that for every ρin that block, [Ω] divides [ρ]. Let |ω|be the length of the word ω.
Note that every Zeckendorf word of length at least 3 that does not represent 1 appears in one
of the blocks.
In a block Ω(Z∪Λ), the number of words ωof length n+|Ω|is approximately Fnso,
asymptotically,
P(0,[Ω]) ≥δ:= 1
φ|Ω|.(6.13)
But this is true of all blocks and, since the entire set of words is a union of blocks, we have
that P(0,[Ω]) is at least δplus δtimes what remains and, in general,
P(0,[Ω]) ≥1−(1 −δ)nfor all n. (6.14)
Hence P(0,[Ω]) = 1 for each Ω and, by Lemma 6.2, since g(2n) = a2n+1 takes on all positive
integer values, the result follows.
16
References
[1] M. Bicknell-Johnson, Stern’s diatomic array applied to Fibonacci representations, Fibonacci Quart. 41
(2003), no. 2, 169-180.
[2] A. Biswath, Various proofs of the fundamental theorem of Markov chains, arXiv:2204.0078
https://doi.org/10.48550/arXiv.2204.00784.
[3] N. Calkin and H. Wilf, Recounting the rationals, Amer. Math. Monthly 107 (2000), no. 4, 360–363.
[4] L. Carlitz, Fibonacci reprentations, Fibonacci Quart. 6 (1968), no. 4, 193-220.
[5] K. Conrad, SL2(Z), UConn lecture notes,
https://kconrad.math.uconn.edu/blurbs/grouptheory/SL(2,Z).pdf
[6] K. Conrad, A multivariable Hensel’s lemma, UConn lecture notes,
https://https://kconrad.math.uconn.edu/blurbs/gradnumthy/multivarhensel.pdf
[7] K. Conrad, Question 424856, MathOverflow,https://mathoverflow.net/q/424856.
[8] R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, Addison-Wesley, Reading, MA,
1990.
[9] A. Knauf, The spectrum of an adelic Markov operator, Indiana Univ. Math. J. 64 (2015), no. 5, 1465–1512.
[10] L. Kuipers and H. Niederreiter, Uniform distribution of sequences, Pure and Applied Mathematics. Wiley-
Interscience [John Wiley and Sons], New York-London-Sydney, 1974. xiv+390 pp.
[11] L. Kuipers and J. Shiu, A distribution property of the sequence of Fibonacci numbers, Fibonacci Quart 10
(1972), no. 4, 375-376, 392.
[12] R. Murty, Problems in Analytic Number Theory, ser. Graduate Texts in Mathematics 206 Springer-Verlag
(2001).
[13] H. Niederreiter, Distribution of Fibonacci numbers mod 5k, Fibonacci Quart. 10 (1972), no. 4, 373–374.
[14] S. Northshield, Stern’s diatomic sequence 0,1,1,2,1,3,2,3,1,4,.. . , Amer. Math. Monthly 117 (2010), no. 7,
581–598.
[15] S. Northshield, Re3counting the rationals, Fibonacci Quart. 57 (2019), no. 5, 111–129.
[16] S. Northshield, Three analogues of Stern’s diatomic sequence, Fibonacci Quart. 52 (2014), no. 5, 168-186.
[17] OEIS Foundation Inc. (2011), The On-Line Encyclopedia of Integer Sequences, http://oeis.org.
[18] P. Sol´e and M. Planat, Extreme values of the Dedekind ψfunction, J. Comb. Number Theory 3 (2011), no.
1, 33–38.
[19] B. Reznick, Regularity properties of the Stern enumeration of the rationals,J. Integer Seq. 11 (2008), no.
4, Article 08.4.1, 17 pp.
Department of Mathematics, SUNY-Plattsburgh, Plattsburgh, NY 12901
Email address:northssw@plattsburgh.edu
17