(15C) Find narcissistic / Armstrong numbers
|
02-28-2024, 04:15 PM
(This post was last modified: 03-01-2024 05:26 PM by jonakeys.)
Post: #1
|
|||
|
|||
(15C) Find narcissistic / Armstrong numbers
Hi everyone,
For a couple of weeks I've added a HP-15C CE to my calculator collection. As I like to program as a hobby, I found a nice challenge in the archive: "Short & Sweet Math Challenges for HP fans #3" Posted by Ex-PPC member on 9 June 2002, 12:43 a.m. The goal is to find Narcissistic or Armstrong numbers, for example: 1^3+5^3+3^3=153 Finding the 4 numbers (and finishing the program) for 3 digits takes around 34 seconds. How to use: Enter an integer (N) and press f LBL A to start the search. When a valid number is found, it is added to matrix A. The display shows 0.0000 when finished. Labels A: Start of program B: Fill storage registers (x^N) C: Calculate value of number D: Iterate over digits E: End Storage registers R1-R9: x^N R.0: N digits R.1: Loop from R.2: Loop to R.3: Sum number R.4: Working number Matrix A: Result numbers I've posted the code also on Github https://github.com/jonakeys/HP-15C I'm sure it can be faster/more efficient, so if you see room for improvement, feel free to comment so I can learn! Code:
edit: Add instructions of how to use / Jonathan HP 15C CE, HP 35S, HP Prime G2, Casio Graph 90+E, TI Nspire CX, TI 83, TI 84+, TI 84+ CE |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(15C) Find narcissistic / Armstrong numbers - jonakeys - 02-28-2024 04:15 PM
RE: (15C) Find narcissistic / Armstrong numbers - Valentin Albillo - 02-28-2024, 11:43 PM
RE: (15C) Find narcissistic / Armstrong numbers - jonakeys - 02-29-2024, 04:43 PM
RE: (15C) Find narcissistic / Armstrong numbers - jonakeys - 03-01-2024, 07:20 AM
RE: (15C) Find narcissistic / Armstrong numbers - Eddie W. Shore - 03-01-2024, 03:29 PM
RE: (15C) Find narcissistic / Armstrong numbers - jonakeys - 03-01-2024, 05:31 PM
|
User(s) browsing this thread: 1 Guest(s)