35s - fun algebraic tricks #2 Gene Wright Posting Freak Posts: 1,545 Threads: 168 Joined: Jul 2005 07-13-2007, 06:35 PM Here's another type of fun algebraic trick that can be used in **RPN** programs. Suppose you have a 3-digit positive number in X and you want to determine the "sum of the digits" of the number. The program below will do this and not destroy the stack! LBL A press EQN RDMR(REGX,10)+RMDR(IDIV(REGX,10),10)+RMDR(IDIV(REGX,100),10) RTN The original stack is pushed to Y, Z and T. If you want to save Y, Z and T instead, then do a RDN after LBL A and change the RMDR line to point at REGT rather than REGX). 69 bytes used, but very handy to preserve the stack. I personally think these types of features will be very powerful in future programs. RMDR is the remainder function, IDIV is integer division, and REGX is the way the 35s refers to the value in register X. REGT would point at the value in the T register. When a function (like RMDR and IDIV) are presented in an algebraic context, it prompts the function name along with the open/close parentheses and a comma supplied (if needed to separate two arguments). To move across the comma to enter the second argument, you press the right arrow key. It's not hard to get used to at all. I'd better stop or this will be yet another learning module. Gene Les Wright Posting Freak Posts: 1,368 Threads: 212 Joined: Dec 2006 07-13-2007, 06:52 PM Gee, this is becoming a regular Nerds Anonymous meeting, isn't it? ;) Don Shepherd Posting Freak Posts: 1,392 Threads: 142 Joined: Jun 2007 07-13-2007, 07:08 PM sigma(i:0:log(n):1:mod(idiv(n:10^i):10)) Works for any length number. Bruce Bergman Senior Member Posts: 553 Threads: 57 Joined: Sep 2006 07-13-2007, 07:10 PM Don, I just KNEW I'd see you here in this thread. :-) :-) thanks, bruce Gene Wright Posting Freak Posts: 1,545 Threads: 168 Joined: Jul 2005 07-13-2007, 07:21 PM Hmm. Sigma doesn't seem to work on the 35s in equation mode. :-) Wish it DID, but... Bruce Bergman Senior Member Posts: 553 Threads: 57 Joined: Sep 2006 07-13-2007, 07:36 PM What? I thought the 35s had the full solver functionality? Is that not true? Or has it been brain-downed? thanks, bruce Don Shepherd Posting Freak Posts: 1,392 Threads: 142 Joined: Jun 2007 07-15-2007, 07:25 AM Bruce, I notice that Sigma is not available in the 33s, which is probably why it is not in the 35s. « Next Oldest | Next Newest »

 Possibly Related Threads... Thread Author Replies Views Last Post Fun graphs on HP Prime Mic 9 2,293 09-15-2013, 08:30 AM Last Post: Eddie W. Shore Fun things found by running strings on the 39gII emulator bhtooefr 11 3,060 05-16-2013, 12:40 AM Last Post: Mic Fun with the HP-35 Gerson W. Barbosa 11 2,806 08-02-2012, 10:58 AM Last Post: Gerson W. Barbosa First post here: something fun... Jeff Dinkins 4 1,339 04-22-2012, 02:42 PM Last Post: Jeroen Van Nieuwenhove devolution of the wp34s label---or fun with colors troy 19 4,503 02-09-2012, 02:52 PM Last Post: Egan Ford HP 15c searchable Adv Fun Handbook (link) - done by Joe Horn Gene Wright 19 3,829 11-24-2011, 04:59 AM Last Post: Joel Setton (France) Immediate algebraic expressions in RPL+ Oliver Unter Ecker 8 1,971 11-19-2011, 04:29 AM Last Post: Oliver Unter Ecker 15C LE -- fun with the PSE Katie Wasserman 6 1,404 09-14-2011, 04:04 PM Last Post: Katie Wasserman WP 34S: Emulator has learned new tricks Marcus von Cube, Germany 0 593 08-30-2011, 06:02 AM Last Post: Marcus von Cube, Germany TI people have more fun Don Shepherd 7 1,827 06-14-2011, 10:45 PM Last Post: Gerson W. Barbosa

Forum Jump: