The purpose of this paper is to present a thorough case study of the programming process. The problem domain is number theory; we design programs to add to what is already known about certain arrangements of natural numbers. This kind of number-theoretic computation presents special challenges to the programmer. Computations can involve thousands of hours of computer time, so efficiency is a primary concern. Specifications are typically loose -they often amount to the vague request “Produce interesting results”-and also are typically formulated by the programmer. The relationship between correctness and efficiency is therefore rather less dominated by the former than is usually (and wisely) expected to be the case. Yet there is a dearth of published methodological material in this area that the interested novice might consult. There are plenty of results to be found, for instance in h4ufhematics ofComputurion, but thorough presentations of the methods whereby those results were obtained are rare. We address this gap in the literature, and take the opportunity to illustrate the programmer’s concerns from a wider perspective than is often taken. We report on our experiences in the design of a suite of programs that tackle a typical (if that is possible) problem in computational number theory. The form of our report is not a formal statement of the problem followed by a derivation of a beautiful solution. Rather, the problem itself is only loosely defined at the outset, since the form of our contribution will depend on what we can do well. Also, several potential solutions (or, more accurately, avenues of approach) are derived, and we present (in Section 9) a detailed discussion of how best to choose between these competing approaches. We feel that the combination of practical complexity analysis and parameter optimization that is involved in this choice is an important and underappreciated aspect of the programmer’s task.
[1]
J. Littlewood,et al.
Some problems of ‘Partitio numerorum’; III: On the expression of a number as a sum of primes
,
1923
.
[2]
S. Weintraub.
Primes in arithmetic progression
,
1977
.
[3]
S. Weintraub.
Seventeen primes in arithmetic progression
,
1977
.
[4]
David Gries,et al.
The Science of Programming
,
1981,
Text and Monographs in Computer Science.
[5]
E. Grosswald.
Arithmetic progressions that consist only of primes
,
1982
.
[6]
R. Guy.
Unsolved Problems in Number Theory
,
1981
.
[7]
Paul Pritchard,et al.
Fast Compact Prime Number Sieves (among Others)
,
1984,
J. Algorithms.
[8]
Paul Pritchard,et al.
Programming Techniques and Data Structures a Sublinear Additive Sieve for Finding Prime Numbers
,
2022
.
[9]
Emil Grosswald,et al.
Arithmetic progressions consisting only of primes
,
1979
.
[10]
Robert S. Boyer,et al.
A fast string searching algorithm
,
1977,
CACM.
[11]
E. Wright,et al.
An Introduction to the Theory of Numbers
,
1939
.
[12]
Donald E. Knuth,et al.
The art of computer programming. Vol.2: Seminumerical algorithms
,
1981
.
[13]
Three Primes and an Almost-Prime in Arithmetic Progression
,
1981
.