# On the Continued Fraction Expansion of Almost All Real Numbers††thanks:
Subject Classification: 11K50, 11A55. Key words: Continued fraction, digits,
random number, Pi.

Alex Jin, Shreyas Singh, Zhuo Zhang, AJ Hildebrand
<EMAIL_ADDRESS>
Department of Mathematics
University of Illinois at Urbana-Champaign
Urbana, IL 61801, USA

(March 14, 2024)

###### Abstract

By a classical result of Gauss and Kuzmin, the continued fraction expansion of
a “random” real number contains each digit $a\in\mathbb{N}$ with asymptotic
frequency $\log_{2}(1+1/(a(a+2)))$.

We generalize this result in two directions: First, for certain sets
$A\subset\mathbb{N}$, we establish simple explicit formulas for the frequency
with which the continued fraction expansion of a random real number contains a
digit from the set $A$. For example, we show that digits of the form $p-1$,
where $p$ is prime, appear with frequency $\log_{2}(\pi^{2}/6)$.

Second, we obtain a simple formula for the frequency with which a string of
$k$ consecutive digits $a$ appears in the continued fraction expansion of a
random real number. In particular, when $a=1$, this frequency is given by
$|\log_{2}(1+(-1)^{k}/F_{k+2})|$, where $F_{n}$ is the $n$th Fibonacci number.

Finally, we compare the frequencies predicted by these results with actual
frequencies found among the first 300 million continued fraction digits of
$\pi$, and we provide strong statistical evidence that the continued fraction
expansion of $\pi$ behaves like that of a random real number.

##  1 Introduction

###  1.1 Decimal expansions and normal numbers

If one picks a “random” real number in $(0,1)$ and expands it in base $10$,
then $1/10$ of the digits will be $0$, $1/10$ will be $1$, and so on. That is,
the proportion of digits $0$ among the first $n$ decimal digits of the number
converges to $1/10$ as $n\to\infty$, and the same holds for any other digit
$d\in\\{0,1,\dots,9\\}$. More generally, any finite string $d_{1}\dots d_{k}$
of $k$ digits in $\\{0,1,\dots,9\\}$ occurs in the decimal expansion of the
number with frequency $1/10^{k}$.

A number whose decimal expansion has this property is called _normal with
respect to base $10$_; normality with respect to other integer bases $b\geq 2$
is defined analogously. It is a classical result of Borel (see [9] or [17,
Theorem 8.11]) that almost all real numbers are normal with respect to all
integer bases $b\geq 2$; that is, the set of numbers that are _not_ normal has
Lebesgue measure $0$. Therefore, if we pick a real number “at random” (e.g.,
uniformly from a finite interval), then, with probability $1$, this number
will be normal, and the statistics of the digits in its decimal (or base $b$)
expansion are well-understood.

In contrast to such “almost all” type results, we know almost nothing about
the statistics of the digits in the expansion of _specific_ irrational
numbers. In fact, with the exception of some specially constructed numbers
(for example, the Champernowne constant [6] $0.1234567891011121314\dots$), for
most “natural” irrational constants it is not even known whether each digit
occurs infinitely often in the decimal expansion of the number. In particular,
this is the case for the number $\pi=3.141592\dots$: Although there exists
overwhelming _statistical_ evidence towards the normality of $\pi$, a proof of
even a very weak form of normality seems to be out of reach; see, e.g., [2],
[4].

###  1.2 Continued fraction expansions

In this paper, we consider similar questions with respect to the _continued
fraction expansion_ of real numbers, that is, expansions of the form

(1.1)
$x=a_{0}+\cfrac{1}{a_{1}+\cfrac{1}{a_{2}+\cfrac{1}{\ddots}}}=[a_{0};a_{1},a_{2},\dots],$

where $a_{0}=\lfloor x\rfloor$ and $a_{i}=a_{i}(x)$, $i=1,2,\dots$, are
positive integers, which we call the _continued fraction digits_ 111We do not
include the leading term $a_{0}$ here as $a_{0}$ may be an arbitrary integer,
while the terms $a_{1},a_{2},\dots$ are restricted to positive integers. of
$x$. It is well-known (see, e.g., [17, Theorem 5.11]) that any _irrational_
number $x$ has a unique _infinite_ continued fraction expansion of the form
(1.1). For example, the continued fraction expansion of $\pi$ is

$\displaystyle\pi=3+\cfrac{1}{7+\cfrac{1}{15+\cfrac{1}{\ddots}}}=[3;7,15,\cdots].$

Conversely, given any integer $a_{0}$ and any sequence of positive integers
$a_{1},a_{2},\dots$, there is a unique irrational number $x$ with continued
fraction expansion (1.1). In this sense, the continued fraction digits are
analogous to the decimal digits of a number, and we can therefore ask similar
questions as above:

  * •

Statistics of continued fraction digits of a random real number. What can we
say about the continued fraction digits of a “random” real number (or,
equivalently, of almost all real numbers)?

  * •

Statistics of continued fraction digits of $\pi$. What can we say about the
continued fraction digits of _specific_ “natural” irrational numbers such as
the number $\pi$? In particular, do the continued fraction digits of $\pi$
behave like those of a random real number?

Our state of knowledge with respect to these two questions is similar to that
for the usual decimal and base $b$ expansions. On the one hand, the
statistical nature of the continued fraction expansion of _almost all_ real
numbers is now well understood. On the other hand, we know almost nothing
about the statistics of the continued fraction digits of $\pi$ and most other
classical constants.

###  1.3 Classical results on the statistics of continued fraction digits

The study of the statistical nature of continued fraction expansions
originated with Gauss and was further developed by Kuzmin [15], Lévy [16],
Khinchin [14], and others. We mention here two classical results in this
field.

_Khinchin’s Theorem_ (see [14, p. 93], or [5, Proposition 4.1.8]) states that
the geometric mean of the first $n$ continued fraction digits of a random real
number converges, as $n\to\infty$, to the constant (now known as _Khinchin’s
constant_)

(1.2)
$K_{0}=\prod_{k=1}^{\infty}\left(1+\frac{1}{k(k+2)}\right)^{\log_{2}k}=2.685452\dots,$

where $\log_{2}$ denotes the base $2$ logarithm. That is, almost all real
numbers $x$ satisfy

(1.3) $\lim_{n\to\infty}\left(a_{1}(x)\dots a_{n}(x)\right)^{1/n}=K_{0},$

where $a_{i}(x)$, $i=1,2,\dots$, are the continued fraction digits of $x$
defined by (1.1).

The _Gauss-Kuzmin Theorem_ (see Lemma 2.1 below) states that the frequency of
a given digit $a\in\mathbb{N}$ in the continued fraction expansion of a random
real number is given by

(1.4) $P(a)=\log_{2}\left(1+\frac{1}{a(a+2)}\right).$

That is, almost all real numbers $x$ satisfy

(1.5) $\lim_{n\to\infty}\frac{1}{n}\\#\\{1\leq i\leq
n:a_{i}(x)=a\\}=P(a),\quad a\in\mathbb{N}.$

Thus, for example, around $\log_{2}(4/3)\approx 41.5\%$ of the continued
fraction digits of a random real number will be $1$, around
$\log_{2}(9/8)\approx 17\%$ of these digits will be $2$, and so on. The
numbers $P(a)$ defined by (1.4) form a discrete probability distribution on
$\mathbb{N}$, called the _Gauss-Kuzmin distribution_ and depicted in Figure 1.

Figure 1: The Gauss-Kuzmin distribution $P(a)=\log_{2}(1+\frac{1}{a(a+2)})$,
$a=1,2,\dots$. ($\log_{2}t=\log t/\log 2$ denotes the base $2$ logarithm.)

As natural extensions of the Gauss-Kuzmin result on the frequency of a single
continued fraction digit $a$, one can consider the following frequencies222For
simplicity of notation, we use the same symbol, $P(\dots)$, to denote single
digit frequencies, subset frequencies, and frequencies of strings. This should
not cause any problems as the meaning will always be clear from the context.:

  * •

Subset frequencies: The frequency, $P(A)$, with which the continued fraction
digits of a random real number belong to a given subset $A\subset\mathbb{N}$.
More precisely, given a set $A\subset\mathbb{N}$ and an irrational number $x$
with continued fraction digits $a_{i}(x)$, $i=1,2,\dots$, we are interested in
the limit

(1.6) $\lim_{n\to\infty}\frac{1}{n}\\#\\{1\leq i\leq n:a_{i}(x)\in A\\}.$

  * •

String frequencies: The frequency, $P(\mathbf{a})$, with which the continued
fraction expansion of a random real number contains a given finite string
$\mathbf{a}=(a_{1},\dots,a_{k})$, of digits $a_{i}\in\mathbb{N}$. More
precisely, given an irrational number $x$ with continued fraction digits
$a_{i}(x)$, we are interested in the limit

(1.7) $\lim_{n\to\infty}\frac{1}{n}\\#\\{1\leq i\leq
n:a_{i+1}(x)=a_{1},\dots,a_{i+k}(x)=a_{k}\\}.$

It follows from the Gauss-Kuzmin theory (see Lemmas 2.1 and 2.2) that, for
almost all real numbers $x$, the limits in (1.6) and (1.7) exist and depend
only on the set $A$ (respectively the string $\mathbf{a}$). This justifies the
use of the notation $P(A)$ and $P(\mathbf{a})$ for these frequencies. The
Gauss-Kuzmin theory also yields explicit formulas for the frequencies $P(A)$
and $P(\mathbf{a})$, but these formulas are in general quite complicated,
involving either infinite sums (in the case of $P(A)$ for infinite sets $A$)
or continued fraction convergents (in the case of $P(\mathbf{a})$). In our
main results, Theorems 1–3 below, we exhibit a class of sets $A$ and strings
$\mathbf{a}$ for which these frequencies have surprisingly simple closed-form
expressions.

###  1.4 Statement of main results

We first consider the frequencies $P(A)$. In the case when the set $A$ is an
arithmetic progression, Nolte [18] (see also Girstmair [10] and [13,
Proposition 4.1.5]) established a closed form expression for the subset
frequency $P(A)$ in terms of the Euler gamma function.

In our first two results, we establish similarly simple expressions for $P(A)$
in the case when $A$ is a set of shifted prime powers or shifted squares,
defined as follows:

(1.8) $\displaystyle\mathcal{P}_{k}$
$\displaystyle=\\{p^{k}-1\in\mathbb{N}:p\text{ prime
}\\}\quad(k\in\mathbb{N}),$ (1.9) $\displaystyle\mathcal{S}$
$\displaystyle=\\{n^{2}-1:n\in\mathbb{N},n>1\\}.$

######  Theorem 1 (Shifted prime powers).

Let $k$ be a positive integer. Then the frequency of digits of the form
$p^{k}-1$, where $p$ is prime, in the continued fraction expansion of a random
real number is given by

(1.10) $P(\mathcal{P}_{k})=\log_{2}\zeta(2k),$

where $\zeta(s)$ is the Riemann zeta function. In particular, the frequency of
digits of the form $p-1$, where $p$ is prime, in the continued fraction
expansion of a random real number is given by

(1.11)
$P(\mathcal{P}_{1})=\log_{2}\zeta(2)=\log_{2}\frac{\pi^{2}}{6}=0.718029\dots.$

######  Theorem 2 (Shifted squares).

The frequency of digits of the form $n^{2}-1$, where $n\in\mathbb{N}$, in the
continued fraction expansion of a random real number is given by

(1.12) $P(\mathcal{S})=\log_{2}\frac{8\pi}{e^{\pi}-e^{-\pi}}=0.121832\dots$

The relatively large value $0.71\dots$ of the frequency (1.11) for “shifted
prime” digits is due to the fact that the set
$\mathcal{P}_{1}=\\{1,2,4,6,10,12,16,18,22,\dots\\}$ of shifted primes is
rather dense at the beginning. In particular, it contains the digits $1$ and
$2$, the two most frequent digits in the continued fraction expansion of a
random number, as well as two of the next four most frequent digits, namely
$4$ and $6$. The combined frequencies of the digits $1,2,4,6$ in
$\mathcal{P}_{1}$ (i.e., the sum of the Gauss-Kuzmin probabilities $P(a)$ for
$a=1,2,4,6$) alone is around $0.67\dots$ and thus accounts for the bulk of the
shifted prime digit frequency given in (1.11). By contrast, the set
$\mathcal{S}$ of shifted squares contains neither of the digits $1$ and $2$
and only one of the first seven digits; hence the much smaller shifted square
digit frequency in (1.12).

We next consider occurrences of finite strings
$\mathbf{a}=(a_{1},\dots,a_{k})$ of continued fraction digits. A key
difference between decimal expansions and continued fraction expansions of a
random real number is that, while the consecutive decimal digits behave like
_independent_ random variables, this is not the case for the continued
fraction digits. That is, the string frequency $P((a_{1},\dots,a_{k}))$ is, in
general, _not_ equal to the product of the corresponding single digit
frequencies, $P(a_{1})\dots P(a_{k})$. In particular, the frequency
$P((a,\dots,a))$ of a “run” of $k$ consecutive digits $a$ is _not_ equal to
$P(a)^{k}$, the $k$-th power of the single digit frequency. In the following
theorem, we determine these run frequencies explicitly in terms of a simple
two-term recurrence sequence, which reduces to the Fibonacci sequence when
$a=1$.

######  Theorem 3 (Strings of identical digits).

Let $a$ and $k$ be positive integers. Then the frequency of a string of $k$
consecutive digits $a$ in the continued fraction expansion of a random real
number is given by

(1.13)
$P(\underbrace{(a,\dots,a)}_{k})=\left|\log_{2}\left(1+\frac{(-1)^{k}}{\left(F^{(a)}_{k+2}\right)^{2}}\right)\right|,$

where $F^{(a)}_{n}$, $n=1,2,\dots$ is defined by

(1.14) $F^{(a)}_{1}=F^{(a)}_{2}=1,\quad
F^{(a)}_{n}=aF^{(a)}_{n-1}+F^{(a)}_{n-2}\quad(n\geq 3).$

In particular, the frequency of a string of $k$ consecutive digits $1$ in the
continued fraction expansion of a random real number is given by

(1.15)
$P(\underbrace{(1,\dots,1)}_{k})=\left|\log_{2}\left(1+\frac{(-1)^{k}}{F_{k+2}^{2}}\right)\right|,$

where $F_{n}$ is the $n$th Fibonacci number.

By estimating the term $F_{k+2}$ in (1.15) via Binet’s formula (see, e.g.,
[11, (10.14.1)]), we obtain the following corollary.

######  Corollary 4.

As $k\to\infty$, the frequency (1.15) of a string of $k$ consecutive digits
$1$ in the continued fraction expansion of a random real number satisfies

(1.16) $P(\underbrace{(1,\dots,1)}_{k})=\frac{5}{\Phi^{2(k+2)}\log
2}\left(1+O\left(\frac{1}{\Phi^{2(k+2)}}\right)\right),$

where $\Phi=(1+\sqrt{5})/2$ is the Golden Ratio.

The approximations provided by the corollary are remarkably accurate, even for
very small values of $k$. Table 1 below shows the exact string frequencies
given by Theorem 3, i.e., $|\log_{2}(1+(-1)^{k}/F_{k+2}^{2})|$, the
approximations provided by Corollary 4, i.e., $5/(\Phi^{2(k+2)}\log 2)$, and
the relative error in these approximations.

$k$ | Exact value | Approximation | Relative error
---|---|---|---
1 | $\log_{2}(4/3)=0.415037\dots$ | 0.401993… | 3.24%
2 | $\log_{2}(10/9)=0.152003\dots$ | 0.153548… | 1.00%
3 | $\log_{2}(25/24)=0.058893\dots$ | 0.058650… | 0.41%
4 | $\log_{2}(65/64)=0.022367\dots$ | 0.022402… | 0.15%
5 | $\log_{2}(169/168)=0.008562\dots$ | 0.008556… | 0.06%

Table 1: Exact and approximate values for the frequencies of a string of $k$
digits $1$ in the continued fraction expansion of a random real number.

.

###  1.5 Outline of paper

The remainder of this paper is organized as follows. In Section 2 we review
the elementary theory of continued fractions, and we state the key results
from the metric theory of continued fractions that we will use in proving our
results. Section 3 contains the proofs of Theorems 1 and 2, and Section 4
contains the proofs of Theorem 3 and Corollary 4. In Section 5 we present
empirical data on the frequencies predicted by these theorems based on the
first 300 million continued fraction digits of $\pi$, and the results of
statistical tests comparing the actual and predicted frequencies. We conclude
in Section 6 with some remarks on possible extensions of our results and open
problems.

##  2 Background on continued fractions

We begin by recalling some key definitions and results from the elementary
theory of continued fractions. Details and proofs can be found in [5, Chapter
2], [11, Chapter 9], [14, Chapters I–II], and [17, Chapter 5],

A _continued fraction_ is a finite or infinite expression of the form

(2.1)
$a_{0}+\cfrac{1}{a_{1}+\cfrac{1}{a_{2}+\cfrac{1}{\ddots}}}=[a_{0};a_{1},a_{2},\dots],$

where $a_{0}$ is an arbitrary integer, and $a_{1},a_{2},\dots$ are positive
integers.

Clearly, any _finite_ (i.e., terminating) continued fraction represents a
rational number. Conversely, any rational number can be represented as a
finite continued fraction $[a_{0};a_{1},\dots,a_{n}]$, and this representation
is unique if we require $a_{n}>1$.

An _infinite_ continued fraction is defined as the limit, as $n\to\infty$, of
the finite continued fractions obtained by truncating the given infinite
continued fraction after $n$ terms:

(2.2)
$[a_{0};a_{1},a_{2},\dots]=\lim_{n\to\infty}[a_{0};a_{1},a_{2},\dots,a_{n}].$

It is known (see, e.g., [17, Theorem 5.11]) that any _irrational_ real number
has a unique infinite continued fraction expansion; that is, there exists a
unique sequence $a_{0},a_{1},a_{2},\dots$ satisfying $a_{0}\in\mathbb{Z}$ and
$a_{i}\in\mathbb{N}$ for $i=1,2,\dots$, such that

(2.3) $x=\lim_{n\to\infty}[a_{0};a_{1},a_{2},\dots,a_{n}].$

Conversely, given any integer $a_{0}$ and any sequence $a_{1},a_{2},\dots$ of
positive integers, the limit (2.2) exists and represents an irrational number.

The numbers $a_{i}$ in the representation (2.3) can be computed recursively by

(2.4) $\displaystyle a_{0}$ $\displaystyle=\lfloor x\rfloor,\quad
r_{0}=x-a_{0},$ (2.5) $\displaystyle a_{n}$
$\displaystyle=\left\lfloor\frac{1}{r_{n-1}}\right\rfloor,\quad
r_{n}=\frac{1}{r_{n-1}}-a_{n}\quad(n\geq 1).$

Given an irrational number $x$ with continued fraction representation (2.3),
the rational numbers represented by the truncated continued fractions
$[a_{0};a_{1},\dots,a_{n}]$, $n=0,1,2,\dots$, are called the _convergents_ of
$x$. The $n$th convergent is traditionally denoted by $p_{n}/q_{n}$; that is,
we have

(2.6) $[a_{0};a_{1},\dots,a_{n}]=\frac{p_{n}}{q_{n}},$

with the convention that the denominator $q_{n}$ is a positive integer and the
numerator $p_{n}$ is an integer relatively prime to $q_{n}$. For example, the
first six convergents for $\pi$ (corresponding to indices $n=0,1,\dots,5$) are

(2.7)
$\frac{3}{1},\quad\frac{22}{7},\quad\frac{333}{106},\quad\frac{355}{113},\quad\frac{103993}{33102},\quad\frac{104348}{33215}.$

A key property of a continued fraction convergent $p_{n}/q_{n}$ for an
_irrational_ number $x$ is that it represents the best rational approximation
to $x$ among all rational numbers with denominator bounded by $q_{n}$. In
other words, if $p/q$ is a rational number with denominator satisfying
$|q|\leq q_{n}$, then either $p/q=p_{n}/q_{n}$ or $|x-p/q|>|x-p_{n}/q_{n}|$.

The numerators $p_{n}$ and denominators $q_{n}$ of the convergents satisfy the
recurrences

(2.8) $\displaystyle p_{-1}=1,\quad p_{0}=a_{0},\quad
p_{n}=a_{n}p_{n-1}+p_{n-2}\quad(n\geq 1),$ (2.9) $\displaystyle q_{-1}=0,\quad
q_{0}=1,\quad q_{n}=a_{n}q_{n-1}+q_{n-2}\quad(n\geq 1).$

From these recurrences it can be proved by induction that

(2.10)
$\frac{p_{n}}{q_{n}}-\frac{p_{n-1}}{q_{n-1}}=\frac{(-1)^{n-1}}{q_{n}q_{n-1}}.$

Since, by (2.9), the numbers $q_{n}$, $n\geq 1$, form a strictly increasing
sequence of positive integers, (2.10) implies that the sequence of convergents
$p_{n}/q_{n}$, $n\geq 1$, converges to a finite limit, given by the real
number $x$ represented by the infinite continued fraction
$[a_{0};a_{1},a_{2},\dots]$. It also follows from (2.10) that the even-indexed
convergents form an increasing sequence and the odd-indexed convergents form a
decreasing sequence; that is, we have

(2.11)
$\frac{p_{0}}{q_{0}}<\frac{p_{2}}{q_{2}}<\frac{p_{4}}{q_{4}}\cdots<x<\cdots\frac{p_{5}}{q_{5}}<\frac{p_{3}}{q_{3}}<\frac{p_{1}}{q_{1}}.$

We conclude this section by stating two key results from the metric theory of
continued fractions that we will need in proving Theorems 1, 2, and 3. These
results lie much deeper than the elementary properties of continued fractions
cited above, and their proofs are quite involved, requiring either very
delicate elementary estimates (see, for example, [14]), or the use of results
from ergodic theory (see, for example, [7] or [13]). Both results are special
cases of a more general theorem which in essence states that the
transformation $T(x)=1/x-\lfloor 1/x\rfloor$ that generates continued
fractions via the recurrence (2.5) is an _ergodic_ transformation on the
interval $[0,1]$ with invariant measure $\mu([0,x])=\log_{2}(1+x)$.

######  Lemma 2.1 (Gauss-Kuzmin Theorem, [13, Proposition 4.1.1]).

For almost all real numbers $x$, each digit $a$, $a=1,2,\dots$, appears in the
continued fraction expansion of $x$ with frequency

(2.12) $P(a)=\log_{2}\left(1+\frac{1}{a(a+2)}\right).$

######  Lemma 2.2 (Generalized Gauss-Kuzmin Theorem, [13, Proposition 4.1.2]).

Let $k$ be a positive integer and let $\mathbf{a}=(a_{1},\dots,a_{k})$ be a
finite string of positive integers. Then, for almost all real numbers $x$, the
string $\mathbf{a}$ appears in the continued fraction expansion of $x$ with
frequency

(2.13)
$P(\mathbf{a})=\left|\log_{2}\left(1+\frac{(-1)^{k}}{(p_{k}+q_{k})(q_{k}+q_{k-1})}\right)\right|$

where $p_{i}$ and $q_{i}$ are the numerators and denominators of the
convergents $p_{i}/q_{i}=[0;a_{1},\dots,a_{i}]$, $i\leq k$, defined
recursively by (2.8) and (2.9) with respect to the _finite_ continued fraction
$[0;a_{1},\dots,a_{k}]$.

##  3 Proof of Theorems 1 and 2

The proofs hinge on the following proposition, which expresses the frequency
$P(A)$ in terms of an infinite product over the set $A$, along with
evaluations for these products in the case of sets of the form
$\mathcal{P}_{k}$ and $\mathcal{S}$.

######  Proposition 3.1 (Explicit formula for subset frequencies).

Let $A\subset\mathbb{N}$. Then, for almost all real numbers $x$, the continued
fraction expansion of $x$ contains a digit from the set $A$ with frequency

(3.1) $P(A)=\log_{2}\prod_{a\in
A}\left(1-\frac{1}{(a+1)^{2}}\right)^{-1}=-\log_{2}\prod_{a\in
A}\left(1-\frac{1}{(a+1)^{2}}\right).$

That is, almost all real numbers $x$ satisfy

(3.2) $\lim_{n\to\infty}\frac{1}{n}\\#\\{1\leq i\leq n:a_{i}(x)\in A\\}=P(A),$

with $P(A)$ given by (3.1).

###### Proof.

By Lemma 2.1 the frequency $P(A)$ defined in (3.2) exists for almost all real
numbers and is given by

$P(A)=\sum_{a\in A}P(a)=\sum_{a\in
A}\log_{2}\left(1+\frac{1}{a(a+2)}\right)=\log_{2}\prod_{a\in
A}\left(1+\frac{1}{a(a+2)}\right).$

Since

$1+\frac{1}{a(a+2)}=\frac{(a+1)^{2}}{(a+1)^{2}-1}=\left(1-\frac{1}{(a+1)^{2}}\right)^{-1},$

this yields (3.1), as desired. ∎

###### Proof of Theorem 1.

Suppose $A$ is a shifted power set, i.e.,
$A=\mathcal{P}_{k}=\\{p^{k}-1:p\text{ prime }\\}$, where $k\in\mathbb{N}$. In
this case the product on the right of (3.1) becomes

(3.3)
$\displaystyle\prod_{a\in\mathcal{P}_{k}}\left(1-\frac{1}{(a+1)^{2}}\right)^{-1}$
$\displaystyle=\prod_{p\text{ prime
}}\left(1-\frac{1}{p^{2k}}\right)^{-1}=\zeta(2k),$

where we have used the Euler product formula for the Riemann zeta function
$\zeta(s)=\sum_{n=1}^{\infty}1/n^{s}$ (see, e.g., [1, Theorem 11.7])

$\zeta(s)=\prod_{p\text{ prime
}}\left(1-\frac{1}{p^{s}}\right)^{-1}\quad(\operatorname{Re}(s)>1).$

Substituting (3.3) into (3.1) yields the desired formula (1.10) for
$P(\mathcal{P}_{k})$.

The formula (1.11) for $P(\mathcal{P}_{1})$ follows on noting that
$\zeta(2)=\sum_{n=1}^{\infty}1/n^{2}=\pi^{2}/6$. ∎

###### Proof of Theorem 2.

When $A$ is the set $\mathcal{S}=\\{n^{2}-1:n\in\mathbb{N},n>1\\}$ of shifted
squares, we have

(3.4)
$\displaystyle\prod_{a\in\mathcal{S}}\left(1-\frac{1}{(a+1)^{2}}\right)^{-1}$
$\displaystyle=\prod_{n=2}^{\infty}\left(1-\frac{1}{n^{4}}\right)^{-1}$
$\displaystyle=\left(\prod_{n=2}^{\infty}\left(1-\frac{1}{n^{2}}\right)\prod_{n=2}^{\infty}\left(1+\frac{1}{n^{2}}\right)\right)^{-1}.$

The first of the two products on the right is easy to evaluate by a
telescoping argument:

(3.5)
$\displaystyle\prod_{n=2}^{\infty}\left(1-\frac{1}{n^{2}}\right)=\lim_{N\to\infty}\prod_{n=2}^{N}\frac{n-1}{n}\cdot\frac{n+1}{n}=\lim_{N\to\infty}\frac{N+1}{2N}=\frac{1}{2}.$

To evaluate the second product, we use Euler’s product formula for the sine
function (see [8] or [21, Section 3.23])

(3.6) $\frac{\sin(\pi z)}{\pi
z}=\prod_{n=1}^{\infty}\left(1-\frac{z^{2}}{n^{2}}\right),$

which is valid for all complex numbers $z$. Setting $z=i$ in (3.6), it follows
that

(3.7) $\frac{\sin(\pi i)}{\pi
i}=\prod_{n=1}^{\infty}\left(1+\frac{1}{n^{2}}\right)=2\prod_{n=2}^{\infty}\left(1+\frac{1}{n^{2}}\right).$

Hence

(3.8) $\displaystyle\prod_{n=2}^{\infty}\left(1+\frac{1}{n^{2}}\right)$
$\displaystyle=\frac{\sin(\pi i)}{2\pi i}=\frac{e^{\pi}-e^{-\pi}}{4\pi}.$

Substituting (3.5) and (3.8) into (3.4) and applying Proposition 3.1 yields

(3.9)
$P(\mathcal{S})=\log_{2}\left(\prod_{n=2}^{\infty}\left(1-\frac{1}{n^{2}}\right)\prod_{n=2}^{\infty}\left(1+\frac{1}{n^{2}}\right)\right)^{-1}=\log_{2}\left(\frac{8\pi}{e^{\pi}-e^{-\pi}}\right),$

as desired. ∎

##  4 Proof of Theorem 3 and Corollary 4

###### Proof of Theorem 3.

Let $a$ and $k$ be positive integers, and let $\mathbf{a}=(a,\dots,a)$ denote
the string consisting of $k$ consecutive digits $a$. By Lemma 2.2, the
frequency $P(\mathbf{a})$ is given by

(4.1)
$P(\mathbf{a})=\left|\log_{2}\left(1+\frac{(-1)^{k}}{(p_{k}+q_{k})(q_{k}+q_{k-1})}\right)\right|,$

where $p_{k}$ and $q_{k}$ are defined recursively by

(4.2) $\displaystyle p_{-1}=1,\quad p_{0}=0,\quad
p_{n}=ap_{n-1}+p_{n-2}\quad(n=1,\dots,k),$ (4.3) $\displaystyle q_{-1}=0,\quad
q_{0}=1,\quad q_{n}=aq_{n-1}+q_{n-2}\quad(n=1,\dots,k).$

Setting

(4.4) $r_{n}=q_{n}+q_{n-1},\quad s_{n}=p_{n}+q_{n},$

it follows from (4.2) and (4.3) that

(4.5) $\displaystyle r_{0}=1,\quad r_{1}=a+1,\quad
r_{n}=ar_{n-1}+r_{n-2}\quad(2\leq n\leq k),$ (4.6) $\displaystyle
s_{0}=1,\quad s_{1}=a+1,\quad s_{n}=as_{n-1}+s_{n-2}\quad(2\leq n\leq k).$

Thus, the sequences $r_{n}$ and $s_{n}$ satisfy the same recurrence as the
sequence $F^{(a)}_{n}$ of Theorem 3. In addition, their values at $n=0$ and
$n=1$, i.e., $r_{0}=s_{0}=1$ and $r_{1}=s_{1}=a+1$, agree with the values of
$F^{(a)}_{n}$ at $n=2$ and $n=3$, namely $F^{(a)}_{2}=1$ and
$F^{(a)}_{3}=aF^{(a)}_{2}+F^{(a)}_{1}=a+1$. Therefore we have

$r_{n}=s_{n}=F^{(a)}_{n+2}\quad(1\leq n\leq k).$

Hence

$\displaystyle\log_{2}\left(1+\frac{(-1)^{k}}{(p_{k}+q_{k})(q_{k}+q_{k-1})}\right)$
$\displaystyle=\log_{2}\left(1+\frac{(-1)^{k}}{r_{k}s_{k}}\right)=\log_{2}\left(1+\frac{(-1)^{k}}{\left(F^{(a)}_{k+2}\right)^{2}}\right).$

Substituting this into (4.1) yields the desired result. ∎

###### Proof of Corollary 4.

Let $\Phi=(1+\sqrt{5})/2=1.618034\dots$ denote the Golden Ratio and let
$\overline{\Phi}=(1-\sqrt{5})/2=1/\Phi=-0.618034\dots$ denote its conjugate.
Then Binet’s formula for Fibonacci numbers (see, e.g., [11, (10.14.1)]) yields

(4.7)
$F_{n}=\frac{\Phi^{n}-{\overline{\Phi}}^{n}}{\sqrt{5}}=\frac{\Phi^{n}}{\sqrt{5}}+O\left(\frac{1}{\Phi^{n}}\right),$

and hence

(4.8)
$\frac{1}{F_{k+2}^{2}}=\frac{5}{\Phi^{2(k+2)}+O(1)}=\frac{5}{\Phi^{2(k+2)}}\left(1+O\left(\frac{1}{\Phi^{2(k+2)}}\right)\right).$

Combining this with the elementary estimate

(4.9) $\log_{2}(1+x)=\frac{\log(1+x)}{\log 2}=\frac{x}{\log
2}\left(1+O(x)\right),$

which holds as $x\to 0$, it follows from Theorem 3 that

(4.10)
$P(\underbrace{(1,\dots,1)}_{k})=\left|\log_{2}\left(1+\frac{(-1)^{k}}{F_{k+2}^{2}}\right)\right|=\frac{5}{\Phi^{2(k+2)}\log
2}\left(1+O\left(\frac{1}{\Phi^{2(k+2)}}\right)\right),$

as claimed. ∎

######  Remark 4.1.

By replacing the $O$-estimates in (4.7), (4.8), and (4.9) with explicit
inequalities, one can obtain an explicit value for the $O$-constant in (4.10)
(i.e., the estimate (1.16) of Corollary 4). In particular, one can show that
an admissible value for this $O$-constant is $1$; that is, the expression
represented by the $O$-term in (4.10) is bounded in absolute value by $\leq
1/\Phi^{2(k+2)}$ for all $k$. We leave out the details, which are routine,
though rather tedious.

##  5 Statistical analysis of continued fraction digits of $\pi$

The number $\pi$ is arguably the most famous mathematical constant, and it has
been the subject of more studies—both theoretical and numerical—than any other
mathematical constant. The decimal expansion of $\pi$ has been calculated to
more than twenty trillion digits [22] and has been subjected to extensive
statistical analyses; see, for example, [3], [4].

By comparison, the continued fraction digits of $\pi$ have received much less
attention in the literature, with most of the empirical studies focusing on
_single digit_ frequencies among the digits of $\pi$. For example, [5, Figure
3.2] shows the deviations between observed and predicted frequencies of digits
$1$ through $15$ based on the first 100 million continued fraction digits of
$\pi$.

In light of Theorems 1–3 it seems natural to compare, in a statistically
rigorous manner, the frequencies predicted by these results (i.e., the actual
frequencies in the continued fraction expansion of a “random” real number),
with the corresponding empirical frequencies based on the continued fraction
digits of $\pi$.

###  5.1 Methodology

Our analysis is based on a data set of $300$ million continued fraction digits
of $\pi$. We first split the full data set of $300$ million digits into $B$
disjoint blocks of length $N$ each (so that $B\cdot N=3\cdot 10^{8}$) and
apply a given statistical test to each of these $B$ blocks. The test outputs a
test statistic (for example, a z-score) for each of the $B$ blocks. We then
employ a second statistical test to compare the $B$ values of the test
statistic to their predicted distribution. Such a two-stage testing procedure
is based on NIST recommendations for randomness tests, and it results in
improved reliability when compared to applying a test to the full data set;
see [19].

To ensure robustness of the results, we carry out our tests with three
different values for the block size, namely blocks of $N=$ 250,000; 500,000;
and 1,000,000 digits. This corresponds to splitting the full set of $300$
million digits into $B=$ 12,000; 6,000; and 3,000 blocks, respectively.

We carry out this process with the following tests.

#### Test I: Z-score test for shifted primes.

By Theorem 1, the predicted frequency of continued fraction digits of the form
$p-1$, where $p$ is prime, is

(5.1) $q=\log_{2}(\pi^{2}/6)=0.718029\dots$

To test this prediction, we model the continued fraction digits as Bernoulli
random variables with parameter $q$ and compute, for each block of size $N$,
the corresponding $z$-score, given by

(5.2) $z=\frac{N_{1}-Nq}{\sqrt{Nq(1-q)}},$

where $N_{1}$ is the actual number of digits of the form $p-1$ among the $N$
digits in the block.

We expect these $z$-scores to be approximately normally distributed. To test
this, we apply the Kolmogorov-Smirnov and Anderson-Darling goodness-of-fit
tests (see [12, 1.3.5.14 and 1.3.5.16]) to this set of $z$-scores.

#### Test II: Z-score test for shifted squares.

We employ an analogous testing procedure to digits of the form $n^{2}-1$,
where $n\in\mathbb{N}$, $n>1$, with the predicted probability being given by
Theorem 2, namely

(5.3) $q=\log_{2}\left(\frac{8\pi}{e^{\pi}-e^{-\pi}}\right)=0.121832\dots$

#### Test III: Longest run of $1$s.

Our third test is based on the predicted frequencies of “runs” of digits $1$
given by Theorem 3, and the approximations provided by Corollary 4.
Specifically, we determine, for each block, the length of the longest run of
consecutive digits $1$, and then compute the average of these longest run
lengths across all blocks. This average can be considered as an approximation
to the _expected_ length of the longest string of $1$s in an appropriate
random model.

While consecutive continued fraction digits are not independent, the result of
Corollary 4 and the numerical data provided in Table 1 suggest that, for
“long” strings of $1$, each additional digit $1$ decreases the frequency by a
factor $q=1/\Phi^{2}\approx 0.381966\dots$. This suggests that, in the context
of “long” runs of $1$s, digits behave approximately like Bernoulli random
variables with probability $q=1/\Phi^{2}$. Let $L_{N,q}$ denote the length of
the longest run of $1$s in a sequence of $N$ independent Bernoulli random
variables that take on the value $1$ with probability $q$, and $0$ with
probability $1-q$. It is known (see [20, (5)]) that, as $N\to\infty$, we have

(5.4)
$E(L_{N,q})=\frac{\log(N(1-q))}{\log(1/q)}+\gamma\log(1/q)-\frac{1}{2}+o(1),$

where $\gamma$ is the Euler-Mascheroni constant. Ignoring the term $o(1)$, we
compare the prediction (5.4) with the average length of the longest run
computed from our data.

#### Implementation notes.

We used _Mathematica 13.1_ to generate the set of $300$ million continued
fraction digits of $\pi$ that formed the basis of our analysis. We used Python
for the first stage tests described above and _Mathematica_ for subsequent
statistical analysis and visualization, such as generating histograms of
z-scores and applying the Kolmogorov-Smirnov and Anderson-Darling goodness-of-
fit tests to the z-scores produced by Tests I and II.

###  5.2 Results

#### Tests I and II:

Figure 2 shows the results of the z-score tests, applied to frequencies of
digits of the form $p-1$ (top row) and $n^{2}-1$ (bottom row) for block sizes
$N=$ 250,000; 500,000; and 1,000,000. The actual distributions of $z$-scores
are shown as density histograms, with the density function of a standard
normal distribution overlayed. The z-scores were computed via formula (5.2)
with the probabilities $q$ being those given by (5.1) for the case of shifted
primes and (5.3) for the case of shifted squares.

Figure 2: Distribution of z-scores for digits of the form $p-1$ (top row) and
$n^{2}-1$ (bottom row), corresponding to block sizes 250,000 (left figure),
500,000 (middle figure), and 1,000,000 (right figure),

The histograms in Figure 2 suggest that the z-scores are approximately
normally distributed, as one would expect under the null hypothesis that the
continued fraction digits of $\pi$ of the form $p-1$ and $n^{2}-1$ behave like
independent Bernoulli random variables, with frequencies $q$ given by (5.1)
and (5.3), respectively.

For a more precise analysis we applied the Kolmogorov-Smirnov and Anderson-
Darling goodness-of-fit tests to each set of z-scores, comparing these scores
to those drawn from a standard normal distribution. The resulting $p$-values
are shown in Table 2. None of these $p$-values is significant at the $0.05$
level, thus providing further strong evidence for the “randomness” of the
continued fraction digits of $\pi$.

Block length | KS p-value | AD p-value
---|---|---
250,000 | 0.4656 | 0.1850
500,000 | 0.0779 | 0.0525
1,000,000 | 0.8915 | 0.8821

Block length | KS p-value | AD p-value
---|---|---
250,000 | 0.6180 | 0.9021
500,000 | 0.9077 | 0.7466
1,000,000 | 0.0643 | 0.1076

Table 2: P-values from the Kolmogorov-Smirnov (KS) and Anderson-Darling (AD)
tests, applied to the z-scores for digits of the form $p-1$ (left table) and
$n^{2}-1$ (right table).

#### Test III:

Table 3 shows the average longest run length, with the average being taken
over all blocks of length $N$, along with the corresponding predicted values,
given by the approximation (5.4) for the expected length of the longest run of
$1$s in a Bernoulli model with parameters $N$ and $q=1/\Phi^{2}$.

Block length | Average longest run length | Prediction
---|---|---
250,000 | 12.5267 | 12.5142
500,000 | 13.2617 | 13.2345
1,000,000 | 13.9567 | 13.9547
Table 3: Average length of the longest run of $1$s in a block of length $N$.
The prediction is based on the asymptotic formula (5.4).

##  6 Concluding Remarks

We conclude this paper by mentioning possible extensions and generalizations
of our results and some open questions suggested by these results.

Proposition 3.1 shows that there is a close connection between the subset
probabilities $P(A)$ defined by (1.6) and identities for infinite products of
the form $\prod_{b\in B}(1-1/b^{2})$. Any set $B$ for which the latter product
has a closed formula gives rise to a set $A$ for which $P(A)$ has a closed
formula of similar type. Theorems 1 and 2 exhibit two classes of sets for
which such closed formulas exist and are strikingly simple. To keep the
exposition simple, we decided to focus on these particular classes of sets,
rather than attempting to state and prove our results in their most general
form.

Here we mention, without proof, one such generalization: Given an integer
$k\geq 2$, let $S_{k}$ be the set of “shifted $k$th powers,” i.e.,
$S_{k}=\\{n^{k}-1:n\in\mathbb{N},n>1\\}$. For $h=1,\dots,k-1$ let
$\omega_{h}=e^{\pi ih/k}$. Then

(6.1)
$P(A)=-\log_{2}\left|\frac{1}{2k\pi^{k-1}}\prod_{h=1}^{k-1}\sin(\pi\omega_{h})\right|.$

This result generalizes Theorem 2 and it can be proved using the same
approach, though the technical details are significantly more involved. In
fact, one can prove a slighly more general result for sets
$S_{k,a}=\\{an^{k}-1:n\in\mathbb{N}\\}$, where $a$ and $k$ are fixed positive
integers.

Theorem 3 on frequencies of strings of the form $(a,\dots,a)$ can also be
generalized in various directions. One such generalization is to strings of
the form $\mathbf{a}=(A,\dots,A)$, consisting of $k$ repeated blocks $A$,
where $A$ is a given finite block of digits. The resulting frequency
$P(\mathbf{a})$ can be expressed in terms of two-term linear recurrence
sequences similar to the sequence $F^{(a)}_{n}$ in Theorem 3, but with
coefficients and initial conditions defined in terms of the block $A$. In the
case of a two-digit block $A=(a,b)$, repeated $k$ times, this frequency is
given by

(6.2)
$P(\underbrace{(A,\dots,A)}_{k})=P(\underbrace{(a,b,\dots,a,b)}_{k})=\left|\log_{2}\left(1+\frac{1}{F^{(ab)}_{k+2}G^{(ab)}_{k+2}}\right)\right|,$

where the sequences $F^{(ab)}_{n}$ and $G^{(ab)}_{n}$ are defined recursively
by

$\displaystyle F^{(ab)}_{1}=b-1,F^{(ab)}_{2}=1,\quad
F^{(ab)}_{n}=(ab+2)F^{(ab)}_{n-1}-F^{(ab)}_{n-2}\quad(n\geq 3),$
$\displaystyle G^{(ab)}_{1}=a-1,G^{(ab)}_{2}=1,\quad
G^{(ab)}_{n}=(ab+2)G^{(ab)}_{n-1}-G^{(ab)}_{n-2}\quad(n\geq 3).$

We note that, from the general theory of linear recurrences, the sequences
$F^{(ab)}_{n}$ and $G^{(ab)}_{n}$ have explicit representations as linear
combinations of roots of the associated characteristic equation.

In testing the predictions of our theorems, we focused on the continued
fraction expansion of the number $\pi$, in part because of the status of $\pi$
as the most famous and most extensively studied mathematical constant, but
also because large sets of continued fraction digits of $\pi$ can reliably be
computed using off-the-shelf software such as _Mathematica_. A possible
direction for future research would be to perform a systematic statistical
analysis of the continued fraction digits of particular classes of irrational
numbers—for example, algebraic numbers of degree greater than $2$.

Among open problems, the most glaring is a proof that the continued fraction
digits of $\pi$ and other “natural” irrational constants are indeed “random,”
in the sense that these numbers fall into the class of “almost all” real
numbers for which results such as the Gauss-Kuzmin theorem and Theorems 1–3
hold. But this seems to be an intractable problem under currently available
methods.

### Acknowledgements

This work originated with an undergraduate research project carried out at the
_Illinois Geometry Lab_ (IGL) at the University of Illinois; we thank the IGL
for providing this opportunity. We are also grateful to the referee for a
careful reading of this paper and many helpful suggestions.

## References

  * [1] Tom M. Apostol.  Introduction to analytic number theory.  Undergraduate Texts in Mathematics. Springer-Verlag, New York-Heidelberg, 1976.
  * [2] Francisco J. Aragón Artacho, David H. Bailey, Jonathan M. Borwein, and Peter B. Borwein.  Walking on real numbers.  Math. Intelligencer, 35(1):42–60, 2013.
  * [3] David H. Bailey.  The computation of $\pi$ to $29,360,000$ decimal digits using Borweins’ quartically convergent algorithm.  Math. Comp., 50(181):283–296, 1988.
  * [4] David H. Bailey and Jonathan Borwein.  Pi Day is upon us again and we still do not know if pi is normal.  Amer. Math. Monthly, 121(3):191–206, 2014.
  * [5] Jonathan Borwein, Alf van der Poorten, Jeffrey Shallit, and Wadim Zudilin.  Neverending fractions, volume 23 of Australian Mathematical Society Lecture Series.  Cambridge University Press, Cambridge, 2014.  An introduction to continued fractions.
  * [6] D. G. Champernowne.  The Construction of Decimals Normal in the Scale of Ten.  J. London Math. Soc., 8(4):254–260, 1933.
  * [7] Karma Dajani and Cor Kraaikamp.  Ergodic theory of numbers, volume 29 of Carus Mathematical Monographs.  Mathematical Association of America, Washington, DC, 2002.
  * [8] W. F. Eberlein.  On Euler’s infinite product for the sine.  J. Math. Anal. Appl., 58(1):147–151, 1977.
  * [9] M Émile Borel.  Les probabilités dénombrables et leurs applications arithmétiques.  Rendiconti del Circolo Matematico di Palermo (1884-1940), 27(1):247–271, 1909.
  * [10] Kurt Girstmair.  Linear relations among asymptotic frequencies in continued fractions.  Monatsh. Math., 191(1):77–91, 2020.
  * [11] G. H. Hardy and E. M. Wright.  An introduction to the theory of numbers.  Oxford University Press, Oxford, sixth edition, 2008.  Revised by D. R. Heath-Brown and J. H. Silverman, With a foreword by Andrew Wiles.
  * [12] N Alan Heckert and James J Filliben.  NIST/SEMATECH e-Handbook of Statistical Methods; Chapter 1: Exploratory data analysis.  https://www.itl.nist.gov/div898/handbook/, 2003.
  * [13] Marius Iosifescu and Cor Kraaikamp.  Metrical theory of continued fractions, volume 547 of Mathematics and its Applications.  Kluwer Academic Publishers, Dordrecht, 2002.
  * [14] A. Ya. Khinchin.  Continued fractions.  University of Chicago Press, Chicago, Ill.-London, 1964.
  * [15] R Kuzmin.  Sur un problème de Gauss.  In Atti del Congresso Internazionale dei Matematici: Bologna del 3 al 10 de settembre di 1928, pages 83–90, 1929.
  * [16] Paul Lévy.  Sur les lois de probabilité dont dépendent les quotients complets et incomplets d’une fraction continue.  Bulletin de la Societé Mathématique de France, 57:178–194, 1929.
  * [17] Ivan Niven.  Irrational numbers, volume No. 11 of The Carus Mathematical Monographs.  Mathematical Association of America, 1956.
  * [18] V. N. Nolte.  Some probabilistic results on the convergents of continued fractions.  Indag. Math. (N.S.), 1(3):381–389, 1990.
  * [19] Fabio Pareschi, Riccardo Rovatti, and Gianluca Setti.  Second-level NIST randomness tests for improving test reliability.  In 2007 IEEE International Symposium on Circuits and Systems, pages 1437–1440. IEEE, 2007.
  * [20] Mark F. Schilling.  The longest run of heads.  College Math. J., 21(3):196–207, 1990.
  * [21] E. C. Titchmarsh.  The theory of functions.  Oxford University Press, Oxford, 1958.  Reprint of the second (1939) edition.
  * [22] Peter Trueb.  Digit statistics of the first 22.4 trillion decimal digits of Pi.  2016\.  Preprint, arXiv:1612.00489.


11institutetext:  RIKEN Center for Life Science Technologies (CLST),
6-7-3 Minatojima-minamimachi, Chuo-ku, Kobe, Hyogo, 650-0047 Japan
{satoshi.kume<EMAIL_ADDRESS>22institutetext: RIKEN CLST-JEOL
Collaboration Center,
6-7-3 Minatojima-minamimachi, Chuo-ku, Kobe, Hyogo, 650-0047 Japan
33institutetext: RIKEN BioResource Center (BRC),
3-1-1, Koyadai,Tsukuba, Ibaraki, 305-0074 Japan
<EMAIL_ADDRESS>44institutetext: Advanced Center for Computing and
Communication (ACCC), RIKEN,
2-1 Hirosawa, Wako, Saitama, 351-0198 Japan
<EMAIL_ADDRESS>
# Development of an Ontology for an Integrated Image Analysis Platform to
enable Global Sharing of Microscopy Imaging Data

Satoshi Kume 1122 Hiroshi Masuya 3344 Yosky Kataoka 1122 Norio Kobayashi To
whom correspondence should be addressed<EMAIL_ADDRESS>
###### Abstract

Imaging data is one of the most important fundamentals in the current life
sciences. We aimed to construct an ontology to describe imaging metadata as a
data schema of the integrated database for optical and electron microscopy
images combined with various bio-entities. To realise this, we applied
Resource Description Framework (RDF) to an Open Microscopy Environment (OME)
data model, which is the de facto standard to describe optical microscopy
images and experimental data. We translated the XML-based OME metadata into
the base concept of RDF schema as a trial of developing microscopy ontology.
In this ontology, we propose 18 upper-level concepts including missing
concepts in OME such as electron microscopy, phenotype data, biosample, and
imaging conditions.

###### Keywords:

Microscopy image, RDF/OWL, Metadata, Open Microscopy Environment

##  1 Introduction

Imaging data is a crucial fundamental in current life science. Recently,
ultra-microstructural imaging data, such as scanning electron microscopy
(SEM), has provided detailed morphological phenomena of tissues and/or cells
[1]: moreover, SEM imaging analysis, such as image segmentation and
reconstruction, is a very interesting topic for big data and computational
science. We are working on the production of the large-scale nano-scale
microstructural imaging data of mammalian (mouse and rat) tissues using SEM
and plan to develop open-accessible metadatabase of microstructural imaging
data from organelles in cells to the tissue structure
(http://www.clst.riken.jp/en/science/labs/collabo/).

To share microscopy images and experimental data, we have employed the
Resource Description Framework (RDF), which is a standardised framework for
data sharing to enable interoperable metadata integration and
multidisciplinary data. However, standardised ontologies that describe optical
and electron microscopy (EM) metadata, including biosamples, bio-resources,
experimental conditions, have not been developed, and integrated analysis of
imaging data with other metadata remains difficult.

The Open Microscopy Environment (OME), an open-source interoperability toolset
for biological imaging data, has been proposed for managing multidimensional
and heterogeneous imaging data for optical microscopy [2]. The translation of
OME data model in XML to OWL/RDF was previously performed [3]. However, in the
old version, extension toward data integration with biosamples, experimental
conditions and other microscopy modalities such as EM were not well examined.
In this paper, we tried to construct RDF-based data model of latest version of
OME (https://github.com/kumeS/ISWC2016) for standardised description of
microscopy image data.

##  2 Method

###  2.0.1 Translation of OME data model to RDF

We extracted key concepts and properties from the OME data model (version:
January 2015) written in XML schema. Then, we reconstructed the relations
between RDF properties and XML elements using the extracted OME properties.

###  2.0.2 Extension of OME data model with biosamples and electron microscopy
images in RDF

To construct a data-interoperable ontology with existing RDF-based biological
and medical data and concepts, we expanded upper-level concepts and properties
extracted from above RDF (e.g. electron microscopy devices and bio-resources).
In particular, we have added new vocabularies for EM experiments, including
phenotype data, biosamples and bio-resources and experimental conditions such
as imaging conditions and sample preparations, as an extension of the RDF
version of the OME data model.

##  3 Results and Discussion

Referencing of image data from experimental results has become more important
in current life science. Thus, we aimed to expand global data integration by
the construction of RDF schema describing imaging metadata in various
biological analyses as well as electron microscopy. The upper-level concepts
and the relation graph of RDF-based data model was constructed from current
version of OME and the schema is summarized in Fig. 1. The proposed RDF/OWL
comprises five categories, i.e. IMAGE, EXPERIMENTER, INSTRUMENT, BIOSAMPLE and
SCREENING. It also contains 18 upper-level ontology concepts, including Image,
SampleContainer, BioSample, PhenotypeData and ImagingCondition classes, which
represent the 7 concepts shown in orange in Fig. 1.

Figure 1: Overview of classes and relations extracted from the OME data model.
The blue classes are directly translated classes from the OME data model, and
the orange classes are the proposed extended classes.

The OME data model primarily focused on optical microscopy devices and image
data. To describe EM devices and imaging conditions, we included class
descriptions such as electron wave and electron gun, in the concept of imaging
conditions. Furthermore, to integrate the microscopy metadata and other
bioresource databases, we added ”Biosample” and ”Bioresource” classes. An
example of an RDF graph written with our ontology is shown in Fig. 2. In this
example, the entities that we want to observe (sample container and sample)
and observation results (liver cells, tissue structure and phenotype data) can
be precisely described. Through the sample and strain RDF entities, microscopy
images can be linked to detailed information described by another database and
ontology, such as the RIKEN BioResource Center
(http://metadb.riken.jp/metadb/db/rikenbrc_mouse). Using the ontology, we
tried to describe about 20,000 imaging data from EM which are obtained from
different staining methodologies in the sample preparation. As a result, we
successfully described these data sets (data not shown).

Figure 2: Extended graph structure that describes images with detailed
biosample information used in an experiment. The blue ovals are instances of
classes translated from the OME data model and the orange ovals are instances
of classes as an extension represented in Fig. 1. The green oval represents
bioresource information as a link to an external database.

In conclusion, our microscopy ontology based on the OME data model can be
applicable to imaging data and associated information obtained by optical and
electron microscopy devices and can reorganise the image data for integrated
image analysis. In future, we will expand the ontology to cooperate with
Biological Dynamics Markup Language [4] and Cellular Microscopy Phenotype
Ontology [5]. We also plan to generate electron microscopy images metadata in
RDF through the RIKEN MetaDatabse (http://metadb.riken.jp) platform which
enables the integration with RIKEN’s various life-science data and globally
published linked open data.

### Acknowledgments

This work was supported by the Management Expenses Grant for RIKEN CLST-JEOL
Collaboration Center.

## References

  * [1] Kasthuri, N., et al: Saturated Reconstruction of a Volume of Neocortex. Cell, 162(3): 648–661. (2015)
  * [2] Allan, C., et al: OMERO: flexible, model-driven data management for experimental biology. Nat. Methods., 9(3): 45–53. (2012)
  * [3] Little S., Hunter J.: Rules-By-Example – a Novel Approach to Semantic Indexing and Querying of Images. Proceeding of 3rd International Semantic Web Conference (2004)
  * [4] Kyoda K., et al: Biological Dynamics Markup Language (BDML): an open format for representing quantitative biological dynamics data. Bioinformatics. 31(7): 1044–1052. (2015)
  * [5] Jupp, S., et al: The cellular microscopy phenotype ontology. J. Biomed Semantics. 7–28. (2016)