Skip to main content

Rotate and Double

  • Chapter
Beauty Is Our Business

Part of the book series: Texts and Monographs in Computer Science ((MCS))

  • 379 Accesses

Abstract

The program developed in this paper solves the problem of finding numbers X such that 2X = Y, where Y is derived from X by right-rotating X one digit position so that the rightmost digit becomes the leftmost digit. The problem is particularly interesting because it has vastly different solutions for number systems other than the decimal system. The developed program has the characteristic that, while it is not difficult to design, it requires a non-trivial proof of termination. This makes the development a nice candidate for demonstrating the merit of Dijkstra’s “separation of concerns.” Once termination is proven, we gain so much insight into the program that it can be substantially improved. Finally, analysis of the “useful” solutions leads to another version and an even more significant improvement in performance.

Copyright © A. N. Habermann This work was supported in part by the ZTE division of Siemens Corporation, Munich, Germany and by a grant from Westinghouse Corporation, Pattsburgh, Pennsylvania.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 169.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 219.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 219.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. E. W. Dijkstra. On the role of scientific thought. In Selected Writings on Computing: A Personal Perspective, page 60, Springer-Verlag, New York, 1982.

    Google Scholar 

  2. H. Loonstra. Inleiding tot de Algebra. P. Noordhof, Groningen, 1968.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1990 Springer-Verlag New York, Inc.

About this chapter

Cite this chapter

Habermann, A.N. (1990). Rotate and Double. In: Feijen, W.H.J., van Gasteren, A.J.M., Gries, D., Misra, J. (eds) Beauty Is Our Business. Texts and Monographs in Computer Science. Springer, New York, NY. https://doi.org/10.1007/978-1-4612-4476-9_18

Download citation

  • DOI: https://doi.org/10.1007/978-1-4612-4476-9_18

  • Publisher Name: Springer, New York, NY

  • Print ISBN: 978-1-4612-8792-6

  • Online ISBN: 978-1-4612-4476-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics