Factoring Integer into Primes: HP 48GX
#1

I have the HP41 PPC ROM which contains a routine for factoring any integer into its prime number factors. I am reverse engineering it to make it run on the HP48GX. But might someone already have done that. Anyone know?

#2

Hi John,

I wrote a prime factor program for my HP67 some time ago. In addition to prime factors, it will give all the primes between two given numbers as well. I'd love to have it on my 48gx, but I'm not that adept at RPL programming. Let me know if you want me to post it.

Best regards, Hal

#3

My HP 48SX came with a factoring prg 'built in', among several other prgs in VAR. It factors a 10 digit number in less than half a sec. It shows automatically how long time it takes.

#4

Quote:
I am reverse engineering it to make it run on the HP48GX.

Joe Horn has done this already:

123456789 RT -> 123456789: { 3 3 3607 3803 } 25.82 seconds (HP-48GX)
5961027250 RT -> 5961027250: { 2 5 5 5 3011 7919} 21.95 seconds
%%HP: T(3)A(D)F(,);
DIR
pf
\<< DUP { } SWAP
DO NP ROT
OVER + ROT ROT /
DUP
UNTIL 1 ==
END DROP SWAP
\->TAG
\>>
NP
\<< DUP \v/ \-> s
\<< DUP
IF 2 MOD
THEN 3
WHILE
DUP2 MOD OVER s <
AND
REPEAT 2
+
END DUP s
IF >
THEN DROP
DUP
END
ELSE 2
END
\>>
\>>
RT
\<< TIME SWAP pf
TIME ROT HMS- HMS\->
3600 * SWAP
\>>
END

I've written a List-to-Algebraic routine that will change { 3 3 3607 3803 } to '3^2*3607*3803'.

Gerson.

#5

Thank you Gerson,

I'll key this into my 48gx and try it out.

Best regards, hal

#6

I'm trying to key in and run this program, which Gerson Barbosa was kind enough to post, and have a couple of questions.

1. What are all the backslashes? I can't find that character listed in the 48G manual. I'm assuming the forward slashes denote division.

2. Could someone help me decipher this line " \<< DUP \v/ \-> s", in particular the backslashes, and the \v/?


My apologies for not being more RPL savvy, but I think I'm not alone in this boat:)

Best regards, hal

#7

When you transfer special calculator characters they get automatically replaced by trigraphs (and back)


trigraphs


Edited: 21 Dec 2008, 1:15 a.m.

#8

Thank you V-PN,

I see the light!! The program works beautifully now.



best regards, hal

#9

V-PN has already been of help. Anyway, this is Joe Horn's program and documentation:

http://www.hpcalc.org/hp48/math/misc/prime.zip

I've just found my L2A (list to algebraic) program, which I thought resided only in my HP-28S memory, here:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=138380 (Message #8)

An even faster program is presented by Joe Horn himself in message #9, which I hadn't read yet. Thanks, Joe!

Regards,

Gerson.



Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime vs TI : Factoring ? HP Pioneer 7 2,342 10-29-2013, 02:00 PM
Last Post: CompSystems
  HP Prime: Edit integer in RPN mode plivesey 15 4,785 10-18-2013, 04:34 PM
Last Post: kris223
  Prime Edit Integer kris223 8 2,495 09-24-2013, 06:43 PM
Last Post: kris223
  Understanding HP-16C integer division Jimi 18 5,035 10-16-2012, 09:13 PM
Last Post: Eddie W. Shore
  Truncating to Integer & Fraction--HP-35A/21A Matt Agajanian 11 2,938 03-31-2012, 10:36 PM
Last Post: Matt Agajanian
  WP34S x=? in integer mode Harald 8 2,143 03-13-2012, 07:00 PM
Last Post: Paul Dale
  Wp34s beta 2: possible serious bug in integer mode Cristian Arezzini 3 1,233 06-10-2011, 06:01 PM
Last Post: Cristian Arezzini
  wp34s Integer Word Size versus 16C Jake Schwartz 7 2,141 05-06-2011, 02:19 AM
Last Post: Walter B
  Windows 7 and HP 48GX Nico Tak 12 3,349 03-01-2011, 04:02 AM
Last Post: Marcus von Cube, Germany
  HP 48GX Squeaky Anthony (USA) 3 1,495 02-09-2011, 01:15 PM
Last Post: Anthony (USA)

Forum Jump: