The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Made a new program for the HP 11C
01-07-2014, 09:21 PM (This post was last modified: 01-07-2014 09:43 PM by vma.)
Post: #1
Made a new program for the HP 11C
Hi,

Today I received my HP 11C, which I bought second hand. It is in good condition and works fine! Smile

Anyway, here is my frist program (I'm still trying to figure out the programming, but at least it works):

Test if number is a prime

Put a number in X (display) and run LBL A ([f] [A]).
Number is a prime if result is 1
Number is not a prime if result is 0

Code:

000 -
001 - 42,21,11 ' LBL A
002 -    44  1 ' STO 1
003 -        2 ' 2
004 -       10 ' /
005 -    44  2 ' STO 2
006 -        2 ' 2
007 -    44  3 ' STO 3
008 - 42,21, 1 ' LBL 1
009 -    45  1 ' RCL 1
010 -    45  3 ' RCL 3
011 -       10 ' /
012 -    42 44 ' FRAC
013 -        0 ' 0
014 -    42 40 ' X=Y
015 -    22  2 ' GTO 2
016 -    45  3 ' RCL 3
017 -        1 ' 1
018 -       18 ' +
019 -    44  3 ' STO 3
020 -    45  2 ' RCL 2
021 -    42 20 ' X>Y
022 -    22  1 ' GTO 1
023 -        1 ' 1
024 -       31 ' R/S
025 -    43 32 ' RTN
026 - 42,21, 2 ' LBL 2
027 -        0 ' 0
028 -       31 ' R/S
029 -    43 32 ' RTN

Would be nice to have this listed in the almost empty software section for the HP 11C (http://www.hpmuseum.org/software/software.htm), but I don't know who to contact.

Have fun!

Regards,
Vitor

PS: I forgot to mention that testing if a number is a prime this way is incredibly slow! The algorithm needs to be improved and the processor is really slow compared with new machines: my TI Nspire CAS will test 100123456789 for prime (it is) in less than one second, while the HP 11C takes several seconds with my program to test if 7 is a prime. This really shows how CPU power has increased over the last 30 years!

HP: HP 11C, HP 40, HP 48GX, HP 95LX, HP 200LX
CASIO: FX-5000F, FX-880P, FX-9860 Slim, ClassPad 330
TI: TI-74, TI Voyage 200, TI Nspire CAS
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Made a new program for the HP 11C - vma - 01-07-2014 09:21 PM



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