maths.special_numbers.armstrong_numbers ======================================= .. py:module:: maths.special_numbers.armstrong_numbers .. autoapi-nested-parse:: An Armstrong number is equal to the sum of its own digits each raised to the power of the number of digits. For example, 370 is an Armstrong number because 3*3*3 + 7*7*7 + 0*0*0 = 370. Armstrong numbers are also called Narcissistic numbers and Pluperfect numbers. On-Line Encyclopedia of Integer Sequences entry: https://oeis.org/A005188 Attributes ---------- .. autoapisummary:: maths.special_numbers.armstrong_numbers.FAILING maths.special_numbers.armstrong_numbers.PASSING Functions --------- .. autoapisummary:: maths.special_numbers.armstrong_numbers.armstrong_number maths.special_numbers.armstrong_numbers.main maths.special_numbers.armstrong_numbers.narcissistic_number maths.special_numbers.armstrong_numbers.pluperfect_number Module Contents --------------- .. py:function:: armstrong_number(n: int) -> bool Return True if n is an Armstrong number or False if it is not. >>> all(armstrong_number(n) for n in PASSING) True >>> any(armstrong_number(n) for n in FAILING) False .. py:function:: main() Request that user input an integer and tell them if it is Armstrong number. .. py:function:: narcissistic_number(n: int) -> bool Return True if n is a narcissistic number or False if it is not. >>> all(narcissistic_number(n) for n in PASSING) True >>> any(narcissistic_number(n) for n in FAILING) False .. py:function:: pluperfect_number(n: int) -> bool Return True if n is a pluperfect number or False if it is not >>> all(pluperfect_number(n) for n in PASSING) True >>> any(pluperfect_number(n) for n in FAILING) False .. py:data:: FAILING :type: tuple .. py:data:: PASSING :value: (1, 153, 370, 371, 1634, 24678051, 115132219018763992565095597973971522401)