Post Reply 
Sum of Digits.
03-25-2016, 11:16 AM
Post: #1
Sum of Digits.
Hi all friends,
Playing with my WP34s, as each days, I was thinking that, in number theory,
often we need know what is the sum of digits presents in register X.
So, based on an pretty old routine from John Kennedy, I would like submit
you this little routine.
Be aware it is not good for "perfects numbers", I am testing another routine
for this special case.
But it is may be helpfull for someone. Here we go :
Code:

001 LBL'TOT'
002 LocR 001
003 STO .00
004 STO- .00
005 # 010
006 /
007 STO+ .00
008 IP
009 STO- .00
010 x[!=]0?
011 BACK 006
012 # 010
013 STO[times] .00
014 RCL .00
015 RTN
016 END

For example, if you type : 123 ==> 6
31416==>15

Hoping servicing you

STO[times] = STO*

GĂ©rard.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Sum of Digits. - ggauny@live.fr - 03-25-2016 11:16 AM
RE: Sum of Digits. - Dieter - 03-25-2016, 01:41 PM
RE: Sum of Digits. - Didier Lachieze - 03-25-2016, 04:37 PM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 05:46 PM
RE: Sum of Digits. - Dieter - 03-25-2016, 06:34 PM
RE: Sum of Digits. - fhub - 03-26-2016, 01:02 PM
RE: Sum of Digits. - Dieter - 03-26-2016, 06:02 PM
RE: Sum of Digits. - fhub - 03-26-2016, 06:17 PM
RE: Sum of Digits. - BarryMead - 03-30-2016, 11:24 AM
RE: Sum of Digits. - Dieter - 03-30-2016, 12:46 PM
RE: Sum of Digits. - BarryMead - 03-30-2016, 07:54 PM
RE: Sum of Digits. - BarryMead - 03-30-2016, 11:11 AM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 07:44 PM
RE: Sum of Digits. - Massimo Gnerucci - 03-25-2016, 08:48 PM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 08:26 PM
RE: Sum of Digits. - Dieter - 03-25-2016, 08:33 PM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 08:37 PM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 08:46 PM
RE: Sum of Digits. - Dieter - 03-25-2016, 08:48 PM
RE: Sum of Digits. - ggauny@live.fr - 03-25-2016, 08:49 PM
RE: Sum of Digits. - Dieter - 03-25-2016, 08:59 PM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 01:17 PM
RE: Sum of Digits. - Dieter - 03-26-2016, 06:16 PM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 07:52 AM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 07:54 AM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 06:22 PM
RE: Sum of Digits. - Dieter - 03-26-2016, 06:27 PM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 08:15 PM
RE: Sum of Digits. - Dieter - 03-26-2016, 09:06 PM
RE: Sum of Digits. - ggauny@live.fr - 03-26-2016, 08:18 PM
RE: Sum of Digits. - ggauny@live.fr - 03-27-2016, 07:10 AM
RE: Sum of Digits. - ggauny@live.fr - 03-29-2016, 11:34 AM
RE: Sum of Digits. - Dieter - 03-29-2016, 07:36 PM
RE: Sum of Digits. - ggauny@live.fr - 03-30-2016, 10:00 AM
RE: Sum of Digits. - Dieter - 03-30-2016, 12:42 PM
RE: Sum of Digits. - ggauny@live.fr - 03-30-2016, 10:04 AM
RE: Sum of Digits. - ggauny@live.fr - 03-30-2016, 05:37 PM
RE: Sum of Digits. - Dieter - 03-30-2016, 06:01 PM
RE: Sum of Digits. - ggauny@live.fr - 03-31-2016, 07:33 AM
RE: Sum of Digits. - Dieter - 03-31-2016, 12:50 PM



User(s) browsing this thread: 1 Guest(s)