Optimizations generating Armstrong numbers

Timothy J. Rolfe · ACM Inroads · 2011

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 n th 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 d n . The final optimization completes in about 2% of the time of the initial implementation.

Read the paper · More papers on PaperTik