A pattern sequence approach to Stern’s sequence
-
Upload
michael-coons -
Category
Documents
-
view
218 -
download
1
Transcript of A pattern sequence approach to Stern’s sequence
Discrete Mathematics 311 (2011) 2630–2633
Contents lists available at SciVerse ScienceDirect
Discrete Mathematics
journal homepage: www.elsevier.com/locate/disc
Note
A pattern sequence approach to Stern’s sequenceMichael Coons a, Jeffrey Shallit b,∗a University of Waterloo, Department of Pure Mathematics, Waterloo, Ontario, N2L 3G1, Canadab University of Waterloo, School of Computer Science, Waterloo, Ontario, N2L 3G1, Canada
a r t i c l e i n f o
Article history:Received 30 April 2011Received in revised form 6 July 2011Accepted 22 July 2011Available online 20 August 2011
Keywords:Stern sequencePattern sequence expansion
a b s t r a c t
Suppose that w ∈ 1{0, 1}∗ and let aw(n) be the number of occurrences of the word w inthe binary expansion of n. Let {s(n)}n⩾0 denote the Stern sequence, defined by s(0) = 0,s(1) = 1, and for n ⩾ 1,
s(2n) = s(n), and s(2n + 1) = s(n) + s(n + 1).
In this note, we show that
s(n) = a1(n) +
−w∈1{0,1}∗
s([w]2)aw1(n)
where w denotes the complement of w (obtained by sending 0 → 1 and 1 → 0) and [w]2denotes the integer specified by the word w ∈ {0, 1}∗ interpreted in base 2.
© 2011 Elsevier B.V. All rights reserved.
1. Introduction
For w ∈ 1{0, 1}∗ let aw(n) denote the number of (possibly overlapping) occurrences of the word w in the binaryexpansion of n.
For w ∈ {0, 1}∗ let• w denote the complement of the word w obtained by sending 0 → 1 and 1 → 0, and• [w]2 denote the integer specified by the word w interpreted in base 2.
Morton and Mourant [7] proved that every sequence of real numbers {S(n)}n⩾0 with S(0) = 0 has a unique patternsequence expansion.
S(n) =
−w∈1{0,1}∗
S([w]2)aw(n)
where S : N → R; here we have used the definition N := {1, 2, 3, . . .}. See also [1,2] and [3, Thm. 3.3.4].The Stern sequence (also called Stern’s diatomic sequence; sequence A002487 in Sloane’s Encyclopedia) is defined by the
recurrence relations s(0) = 0, s(1) = 1, and, for n ⩾ 1, bys(2n) = s(n), and s(2n + 1) = s(n) + s(n + 1).
This famous sequence has many interesting properties; for example, see [5] and the recent survey of Northshield [8].Applying Morton and Mourant’s theorem to the Stern sequence, we obtain
s(n) = a1(n) + a101(n) + 2a1001(n) + a1011(n) + a1101(n) + 3a10001(n) + · · · .
In this note, we give the closed form for this expansion, as follows:
∗ Corresponding author.E-mail addresses:[email protected] (M. Coons), [email protected] (J. Shallit).
0012-365X/$ – see front matter© 2011 Elsevier B.V. All rights reserved.doi:10.1016/j.disc.2011.07.029
M. Coons, J. Shallit / Discrete Mathematics 311 (2011) 2630–2633 2631
Theorem 1.1. For all n ⩾ 0, we have
s(n) = a1(n) +
−w∈1{0,1}∗
s([w]2)aw1(n).
Note that if w ∈ 1{0, 1}∗, then [w]2 < [w]2, so our theorem could also serve as an alternative definition of s(n).Our result can be contrasted with an unpublished result of Calkin and Wilf [5, Thm. 5], which was recently rediscovered
by Bacher [4, Prop. 1.1] (see also [6, p. 148]):
Proposition 1.2 (Calkin and Wilf). The nth Stern value s(n) is equal to the number of subsequences of the form1, 101, 10101, . . . = {1(01)∗} in the binary expansion of n.
Here by ‘‘subsequence’’ we mean a subsequence that is not necessarily contiguous.
2. Needed lemmas
Wewill need the following two lemmas, the first of which is quite classical and follows directly from thework of Stern [9](and is easily proven using induction on k).
Lemma 2.1 (Stern). Let k and n be nonnegative integers. If n ⩽ 2k then
s(2k+ n) = s(2k
− n) + s(n).
Lemma 2.2. Suppose that n ⩾ 1 and write n =∑k
ℓ=0 2iℓ where 0 ⩽ i0 < · · · < ik. Then
s(n + 1) = 1 +
k−m=0
s
2im+1
−
m−ℓ=0
2iℓ − 1
.
Proof. Suppose that n ⩾ 1 and write n =∑k
ℓ=0 2iℓ where 0 ⩽ i0 < · · · < ik. Note that
k−m=0
s
2im+1
−
m−ℓ=0
2iℓ − 1
=
k−m=0
s
2im −
m−1−ℓ=0
2iℓ − 1
,
where we use the ordinary convention that the empty sum equals 0.Since
m−1−ℓ=0
2iℓ + 1 ⩽ 2im ,
we can apply Lemma 2.1 to give
k−m=0
s
2im −
m−1−ℓ=0
2iℓ − 1
=
k−m=0
s
2im +
m−1−ℓ=0
2iℓ + 1
− s
m−1−ℓ=0
2iℓ + 1
=
k−m=0
s
m−
ℓ=0
2iℓ + 1
− s
m−1−ℓ=0
2iℓ + 1
= s
k−
ℓ=0
2iℓ + 1
− s(1)
= s(n + 1) − 1.
A minor rearrangement gives the desired result. �
3. Proof of the theorem
Suppose that k ∈ N and let (k)2 denote the unique word w ∈ 1{0, 1}∗ for which [w]2 = k; that is, (k)2 is the canonicalbase-2 representation of the integer k. We say that w ∈ {0, 1}∗ is a suffix of (k)2 if there exists v ∈ {0, 1}∗ (possibly empty)such that vw = (k)2. As usual, let |w| denote the length of the word w ∈ {0, 1}∗.
2632 M. Coons, J. Shallit / Discrete Mathematics 311 (2011) 2630–2633
Proof of Theorem 1.1. Define the sequence {f (n)}n⩾0 by
f (n) := a1(n) +
−w∈1{0,1}∗
s([w]2)aw1(n).
Thus to prove the theorem, it is enough to show that f (n) = s(n) for all n. Our proof is by induction on n.For n = 0, the sum over w ∈ 1{0, 1}∗ is 0, and so we have immediately that
f (0) = a1(0) = 0 = s(0).
For n = 1, again we have that the sum over w ∈ 1{0, 1}∗ is 0, and so
f (1) = a1(1) = 1 = s(1).
For the induction step, we will need to obtain some recursions for f (n). For even integers, we have a1(2n) = a1(n) since(2n)2 = (n)20. For this same reason, those w ∈ 1{0, 1}∗ with aw1(2n) = 0 are precisely those for which aw1(n) = 0, and soaw1(2n) = aw1(n). Thus−
w∈1{0,1}∗s([w]2)aw1(2n) =
−w∈1{0,1}∗
s([w]2)aw1(n),
and so
f (2n) = f (n).
Getting to our last relationship is a bit more complicated. The last bit in (2n + 1)2 is equal to 1. Recalling that thosew ∈ 1{0, 1}∗ with aw1(2n) = 0 are precisely those for which aw1(n) = 0 and that aw1(2n) = aw1(n), we have−
w∈1{0,1}∗s([w]2)aw1(2n + 1) =
−w∈1{0,1}∗
s([w]2)aw1(n) +
−w∈1{0,1}∗1
w is a suffix of (2n+1)2
s([w]2). (1)
Note that it is immediate that a1(2n + 1) = a1(n) + 1. Combining this with (1) gives that
f (2n + 1) = f (n) + 1 +
−w∈1{0,1}∗
w1 is a suffix of (2n+1)2
s([w]2). (2)
We have thatw ∈ 1{0, 1}∗ : w1 is a suffix of (2n + 1)2
=w ∈ 1{0, 1}∗ : w is a suffix of (n)2
.
Now suppose that n ⩾ 1 and write n =∑k
ℓ=0 2iℓ where 0 ⩽ i0 < i1 < · · · < ik. Note that for all w ∈ 1{0, 1}∗, we get
[w]2 = 2|w|− [w]2 − 1.
This gives −w∈1{0,1}∗
w1 is a suffix of (2n+1)2
s([w]2) =
−w∈1{0,1}∗
w is a suffix of (n)2
s(2|w|− [w]2 − 1) =
k−m=0
s
2im −
m−1−ℓ=0
2iℓ − 1
.
Applying the previous equality and Lemma 2.2 to (2) gives the equality
f (2n + 1) = f (n) + s(n + 1) (n ⩾ 1).
Recall that we have already shown that f (0) = s(0), f (1) = s(1) and that f (2n) = f (n).We can now apply induction directly. Suppose that f (j) = s(j) for all j such that 0 ⩽ j < n and consider f (n). If n is even,
write n = 2m and note thatm < n. Then
f (n) = f (2m) = f (m) = s(m) = s(2m) = s(n).
If n ⩾ 3 is odd, write n = 2m + 1 and note that 1 ⩽ m < n. Then
f (n) = f (2m + 1) = f (m) + s(m + 1) = s(m) + s(m + 1) = s(2m + 1) = s(n).
Thus f (n) = s(n) for all n ⩾ 0 and the theorem is proved. �
Acknowledgments
The research of M. Coons was supported by a Fields-Ontario Fellowship and NSERC, and the research of J. Shallit wassupported by NSERC.
M. Coons, J. Shallit / Discrete Mathematics 311 (2011) 2630–2633 2633
References
[1] J.-P. Allouche, P. Morton, J. Shallit, Pattern spectra, substring enumeration, and automatic sequences, Theoret. Comput. Sci. 94 (2) (1992) 161–174.[2] J.-P. Allouche, J. Shallit, The ring of k-regular sequences, Theoret. Comput. Sci. 98 (2) (1992) 163–197.[3] J.-P. Allouche, J. Shallit, Automatic Sequences: Theory, Applications, Generalizations, Cambridge University Press, 2003.[4] R. Bacher, Twisting the Stern sequence, Preprint. http://arxiv.org/pdf/1005.5627.[5] N.J. Calkin, H.S. Wilf, Binary partitions of integers and Stern–Brocot-like trees (1998) (unpublished). Updated version August 5, 2009, 19 pages.[6] S.R. Finch, Mathematical Constants, in: Encyclopedia of Mathematics and its Applications, vol. 94, Cambridge University Press, Cambridge, 2003.[7] P. Morton, W. Mourant, Paper folding, digit patterns, and groups of arithmetic fractals, Proc. Lond. Math. Soc. (3) 59 (2) (1989) 253–293.[8] S. Northshield, Stern’s diatomic sequence 0, 1, 1, 2, 1, 3, 2, 3, 1, 4, . . ., Amer. Math. Monthly 117 (7) (2010) 581–598.[9] M.A. Stern, Über eine zahlentheoretische Funktion, J. Reine Angew. Math. 55 (1858) 193–220.
Further reading
[1] R.P. Stanley, H.S. Wilf, Refining the Stern diatomic sequence, Preprint.