skip to main content
research-article

Optimizations generating Armstrong numbers

Published:01 June 2011Publication History
Skip Abstract Section

Abstract

This article explores various optimizations that can be used to speed the discovery of Armstrong numbers (also known as Narcissistic numbers), which are n-digit numbers that are the sum of the nth powers of their digits. Optimizations include comparing the parity of the least-significant digit of the number and that of the sum of its digits, using a dynamic programming approach for the powers of digits, examining the parity of the sum of digits excluding the least-significant digit, and computing forward bounds on the possible numbers and on the possible sums of dn. The final optimization completes in about 2% of the time of the initial implementation.

References

  1. Weisstein, Eric W. "Narcissistic Number." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/NarcissisticNumber.html. Accessed 2010 December 15.Google ScholarGoogle Scholar
  2. G.H. Hardy, A Mathematician's Apology (First Electronic Edition, Version 1.0; University of Alberta Mathematical Sciences Society, March 2005), pp. 24--25. Accessible through http://www.math.ualberta.ca/~mss/misc/A%20Mathematician's%20Apology.pdf. Accessed 2010 December 20.Google ScholarGoogle Scholar
  3. John 21:11, taken from The Complete Bible: An American Translation, Old Testament translation by J.M.Powis Smith et al., the Apocrypha and New Testament translated by Edgar J. Goodspeed (The University of Chicago Press, 1939), New Testament p. 109.Google ScholarGoogle Scholar
  4. Lionel Deimel, http://www.deimel.org/rec_math/DI_0.htm. Access 2010 December 20.Google ScholarGoogle Scholar
  5. Martin Gardner, The Incredible Dr. Matrix (Charles Scribner's Sons, 1976) p. 36, but especially pp. 205--209.Google ScholarGoogle Scholar
  6. Lionel Deimel, http://www.deimel.org/rec_math/DI_6.htm. Accessed 2010 December 20.Google ScholarGoogle Scholar
  7. http://www.deimel.org/rec_math/armstrong.pdf. Accessed 2010 December 20.Google ScholarGoogle Scholar
  8. Anany Levitin, Introduction to the Design and Analysis of Algorithms (2nd edition; Pearson Education, Inc., 2007) p. 159. Also discussed in Thomas H. Cormen et al., Introduction to Algorithms (3rd edition; MIT Press, 2009), pp. 956--58. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Sanjoy Dasgupta et al., Algorithms (McGraw Hill Higher Education, 2008) pp. 272 ff. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. http://en.wikipedia.org/wiki/Narcissistic_number. Accessed 2010 December 20.Google ScholarGoogle Scholar

Index Terms

  1. Optimizations generating Armstrong numbers

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Inroads
            ACM Inroads  Volume 2, Issue 2
            June 2011
            87 pages
            ISSN:2153-2184
            EISSN:2153-2192
            DOI:10.1145/1963533
            Issue’s Table of Contents

            Copyright © 2011 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 June 2011

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article
            • Popular
            • Refereed
          • Article Metrics

            • Downloads (Last 12 months)13
            • Downloads (Last 6 weeks)9

            Other Metrics

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader

          HTML Format

          View this article in HTML Format .

          View HTML Format