12 January 2016

prerequisites: A basic knowledge of Haskell or similar.

1. Introduction

The goal of this post is to introduce and formalize Moessner’s theorem and Moessner’s sieve.

The post is structured as follows. In Section 2, we introduce the basics of Moessner’s theorem and Moessner’s sieve. Afterwards, we discuss some of the generalizations of Moessner’s theorem in Section 3, and finally implement Moessner’s sieve in Section 4. The post is concluded in Section 5.

2. Moessner’s theorem and Moessner’s sieve

Moessner’s theorem was originally conjectured by Alfred Moessner in 19511 and subsequently proved by Oskar Perron2 – less than a year after its initial publication. Moessner’s theorem states that given an initial sequence of positive natural numbers,

and a natural number we obtain the result sequence of successive powers,

when performing the following procedure:

  1. Drop every th element of the inital sequence,
  2. partially sum the remaining elements into a new sequence, and
  3. decrease by .

The above procedure is repeated if and stops if . We name the procedure Moessner’s sieve3 and call the rank of the sieve.

In order to illustrate Moessner’s theorem we go through its most basic example, where we apply Moessner’s sieve of rank on the initial sequence of positive natural numbers,

Here, we start by dropping every nd element of the initial sequence, , then partially sum the remaining values, , and obtain a new sequence, . Finally, is decreased from 2 to 1 and the procedure stops. As stated by the theorem, the resulting sequence now corresponds to the sequence of squares,

For the remainder of this post, we contract the dropping and partial summing of Moessner’s sieve into a single step and mark the dropped elements by making them boldface. Using this notation, the above example becomes,

where the condition still holds that and the result sequence is the sequence of squares. Before we proceed with some of the generalizations of Moessner’s theorem, let us go through one more example:

If we let the rank be and let the initial sequence be the positive natural numbers, we obtain the result,

by performing the following steps of Moessner’s sieve:

  • Drop every rd element of the initial sequence, then
  • partially sum the remaining elements into a new sequence, and
  • decrease by . Repeat the procedure, by
  • dropping every nd element of the intermediate sequence,
  • partially sum the remaining elements into a new sequence, and
  • decrease by . Finally,
  • the procedure stops as and the result sequence is .

As stated by Moessner’s theorem, the result sequence now corresponds to the sequence of cubes,

Next, we look at some of the generalizations of Moessner’s theorem.

3. Generalizations of Moessner’s theorem

In this section, we discuss a few of the ways in which to generalize Moessner’s theorem, specifically:

  • How to generalize the initial sequence of positive natural numbers, and
  • how to generalize the statement of Moessner’s theorem using Pascal’s triangle.

We go through each of the generalizations in turn.

3.1 Generalizing the initial sequence of Moessner’s theorem

If we examine the mechanics of Moessner’s sieve, we notice that the initial sequence of positive natural numbers can be viewed as the result of another partial summation, i.e., we can obtain the sequence of positive natural numbers by partially summing the sequence of s. Thus, instead of starting from the initial sequence of the positive natural numbers, we can start from the initial sequence of s by first dropping every th element, while still obtaining the result sequence in Formula \ref{intro-sequence-of-successive-powers}. So, if we let the rank and use the initial sequence of s, we obtain the following result,

where the result sequence is still the sequence of cubes, , as in the previous example, even though we have simplified the initial sequence. Once again, we notice that the new initial sequence of s is actually also the result of a partial summation. Specifically, we can obtain the sequence of s by partially summing the sequence of a followed by s. This suggests that if we use the sequence of a followed by s as the initial sequence, and start by dropping every th element of the initial sequence, we still obtain the intended result sequence,

Finally, we notice that the initial sequence of a followed by s is not the result of a partial summation, and we have therefore reached the end of our generalization of the initial sequence.4

3.2 Generalizing Moessner’s theorem using Pascal’s triangle

In 1966, Calvin T. Long picked up Moessner’s theorem and observed that the implicit triangles - which we call Moessner triangles - that appear when laying out Moessner’s sieve as shown below,

are constructed in a similar way to Pascal’s triangle,

The similarity lies in the observation that each entry in Pascal’s triangle is the sum of the two values immediately above it,5

while each entry in a Moessner triangle is the sum of the value immediately above it (northern neighbor) and left of it (western neighbor),

suggesting an equivalence relation between the two functions generating the triangles. This connection is also emphasized by the first Moessner triangle in Figure \ref{eq:mossiv-ones-rank-4}, as it has the same entries as Pascal’s triangle in Figure \ref{eq:pascal-triangle-rank-4}.6

Long used this observation about the similar constructions to prove a new generalization of Moessner’s theorem, which involved the introduction of a generalized version of Pascal’s triangle,

starting from two arbitrary sequences, and , instead of two sequences of s. Long then showed how using an arithmetic progression as the initial sequence,

yields the following result sequence,

where corresponds to the number of iterations in Moessner’s sieve. When letting and , the initial sequence in Formula \ref{eq:related-work-long-initial-sequence} corresponds to the positive natural numbers,

and the result sequence in Formula \ref{eq:related-work-long-partial-sums-sequence} becomes the sequence of successive powers,

yielding Moessner’s theorem.7

Having covered the basics of Moessner’s theorem and some of its generalizations, we now take a closer look at Moessner’s sieve and formalize it in Haskell.

4. Implementing Moessner’s sieve

In order to formalize and implement Moessner’s sieve, we start by restating the description of Moessner’s sieve, as described in Section 2.

Given an initial sequence and a natural number , repeat the procedure:

  1. Drop every th element of the initial sequence,
  2. partially sum the remaining elements into a new sequence, and
  3. decrease by .

Repeat the above procedure with the new sequence as the initial sequence if and stop if .

The first step, in the process of translating the above description into Haskell, is to define the types we are going to use. Thus, we represent a sequence of values as a Stream type, corresponding to a list of Int,

1
type Stream = [Int]

and we represent a rank as a Rank type, corresponding to an Int,

1
type Rank = Int

Then, we translate Step 1. of the Moessner’s sieve procedure to the stream operator dropEvery,

1
2
dropEvery :: Int -> Stream -> Stream
dropEvery n σ = (take n σ) ++ (dropEvery n $ drop (n + 1) σ)

which works by taking the n first elements of a Stream, σ, and then recursively calling itself with σ where the n + 1 first elements have been dropped, thereby removing the (n + 1)th element of the resulting Stream.

In order to translate Step 2. we first define a partiallySum stream operator,

1
2
3
4
partiallySum :: Int -> Stream -> Stream
partiallySum a σ =
  let a' = a + (head σ)
  in a' : (partiallySum a' $ tail σ)

which, given an accumulator, a, partially sums the elements of a Stream, σ, by adding the head of the Stream to the accumulator and recursively calling itself with the tail of σ. Then, we define the stream operator sieveStep,

1
2
sieveStep :: Rank -> Stream -> Stream
sieveStep n σ = (partiallySum 0) . (dropEvery n) $ σ

as the function composition of dropEvery and partiallySum, which reflects the logic of Step 1. and 2. of Moessner’s sieve, by dropping every nth element of a Stream, σ, and then partially summing the remaining elements. Finally, we capture Step 3. of Moessner’ sieve, and the conditional check of the rank, as the stream operator moessnersSieve,

1
2
3
moessnersSieve :: Rank -> Stream -> Stream
moessnersSieve 0 σ = σ
moessnersSieve n σ = moessnersSieve (n - 1) (sieveStep n σ)

which returns its Stream argument, σ, when n = 0, and otherwise recursively calls itself with n - 1 and one iteration of the sieveStep operator applied to σ. To demonstrate that our formalization is in alignment with Moessner’s theorem, we define the Stream of natural numbers, nats, and check that the first five values of the result Stream, obtained when applying moessnersSieve with rank 1..3 on nats, yields the expected results,

1
2
3
4
5
6
nats :: Stream
nats = [1..]

(take 5 $ moessnersSieve 1 nats) == [1,4,9,16,25]
(take 5 $ moessnersSieve 2 nats) == [1,8,27,64,125]
(take 5 $ moessnersSieve 3 nats) == [1,16,81,256,625]

This completes our implementation of Moessner’s sieve and we are now ready to conclude this post.

5. Conclusion

In this post, we have introduced Moessner’s theorem and Moessner’s sieve, along with some of the generalizations of Moessner’s theorem. Furthermore, we have formalized and implemented Moessner’s sieve in Haskell.

In our next post, we introduce the dual to Moessner’s sieve, which generates Moessner triangles in a column-by-column fashion.

  1. See “Eine Bemerkung über die Potenzen der natürlichen Zahlen” (1951) by Alfred Moessner. 

  2. See “Beweis des Moessnerschen Satzes” (1951) by Oskar Perron. 

  3. The name Moessner’s sieve was first coined by Olivier Danvy in the paper “A Characterization of Moessner’s sieve” (2014). 

  4. See “A Characterization of Moessner’s sieve” (2014) by Danvy et al. 

  5. See the post “An introduction to Pascal’s triangle and the binomial coeffcient” for more about the intuition behind Pascal’s triangle. 

  6. See the post “Rotating Pascal’s triangle and the binomial coefficient” on how to rotate Pascal’s triangle to resemble the first Moessner triangle. 

  7. See “On the Moessner Theorem on Integral Powers” (1966) by Calvin T. Long.