Abstract
The problem of finding prime numbers has been much favoured by expositors of modern programming methodology. In this paper the problem is tackled once more, but from a broader view of the programming process than has previously been taken. The initial steps toward a solution parallel those in the well-known presentations of Dijkstra and Wirth. However a general program transformation is shown to capture the clever "inventive step" in Dijkstra's solution, and another is employed to lead naturally to an alternative program. Complexity analyses of the two programs show that the latter is significantly more efficient.
Chapter PDF
Similar content being viewed by others
References
BAYS, C., and HUDSON, R.H. (1977): "The Segmented Sieve of Eratosthenes and Primes in Arithmetic Progression to 1012". B.I.T., Vol. 17, pp 121–127.
DIJKSTRA, E.W. (1972): "Notes on Structured Programming". In "Structured Programming", Academic Press, New York, pp. 1–82.
DIJKSTRA, E.W. (1976): "A Discipline of Programming". Prentice-Hall, Englewood Cliffs, New Jersey.
HARDY, G.H., and WRIGHT, E.M. (1965): "An Introduction to the Theory of Numbers". Fourth edition, O.U.P., London.
HOARE, C.A.R. (1972): "Notes on Data Structuring". In "Structured Programming", Academic Press, New York, pp.83–174.
MCMASTER, C.L. (1978): "An Analysis of Algorithms for the Dutch National Flag Problem". Comm. ACM, Vol. 21, No. 10, pp. 842–846.
PRITCHARD, P.A. (1978): "Program Design Via Multiple-Pass Algorithms". Typescript, Canberra, dated May 1978.
PRITCHARD, P.A. (1979a): "On the Prime Example of Programming". In "Variations on a Scheme of Eratosthenes", Tech. Report No. 8, Dept. of Computer Science, Univ. of Queensland, pp. 1–21.
PRITCHARD, P.A. (1979b): "On a Proposed Method of Generating Prime Numbers". In "Variations on a Scheme of Eratosthenes", Tech. Report No. 8, Dept. of Computer Science, Univ. of Queensland, pp. 22–28.
PRITCHARD, P.A. (1979c): "A Fast Linear Sieve for Finding Prime Numbers". In "Variations on a Scheme of Eratosthenes", Tech. Report. No. 8, Dept. of Computer Science, Univ. of Queensland, pp. 29–41.
WIRTH, N. (1973): Systematic Programming: An Introduction. Prentice-Hall, Englewood Cliffs, New Jersey.
Author information
Authors and Affiliations
Editor information
Copyright information
© 1980 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pritchard, P. (1980). On the prime example of programming. In: Tobias, J.M. (eds) Language Design and Programming Methodology. LDPM 1979. Lecture Notes in Computer Science, vol 79. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-09745-7_5
Download citation
DOI: https://doi.org/10.1007/3-540-09745-7_5
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-09745-7
Online ISBN: 978-3-540-38579-0
eBook Packages: Springer Book Archive