Post Reply 
Prime Factors in the ALPHA REG.
12-09-2015, 06:32 PM (This post was last modified: 12-09-2015 06:33 PM by fhub.)
Post: #8
RE: Prime Factors in the ALPHA REG.
(12-09-2015 06:29 PM)Dieter Wrote:  Yes, you can't. Choose any method, and there will be a limit where it doesn't work.
One more reason to return the prime factors one at a time (via R/S).
Yes, here's the way I would do it (separated primefactors in X and exponents in alpha), thus no limit to 11 digits -
it's just a modification of my old 'PF' in the WP34s library:
Code:

/*
  Prime Factorization:  list of 'true' prime factors (1<pf<n)

  Input:  X:n (positive integer)
  Output: X:pf1 (primefactor1) Alpha:^ex1 (exponent1)
   [R/S]  X:pf2 (primefactor2) Alpha:^ex2 (exponent2)
   [R/S]  .....
   [R/S]  n
  Used:   XYZT
*/

0001 LBL'PF'
0002 LocR 004
0003 INT?
0004 x<1?
0005 RTN
0006 STO .00
0007 2
0008 RCL Y
0009 [sqrt]
0010 IP
0011 STO .03
0012 DROP
0013 x>? .03
0014 SKIP 013
0015 [cmplx]ENTER
0016 MOD
0017 x=0?
0018 SKIP 005
0019 DROP
0020 INC X
0021 EVEN?
0022 INC X
0023 BACK 010
0024 DROP
0025 XEQ 00
0026 STO/ Y
0027 BACK 019
0028 DROP
0029 XEQ 00
0030 CLSTK
0031 RCL .00
0032 LBL 00
0033 x[!=]? .01
0034 SKIP 002
0035 INC .02
0036 SKIP 011
0037 # 001
0038 RCL Y
0039 [cmplx]x[<->] .01
0040 x=0?
0041 SKIP 005
0042 CL[alpha]
0043 [alpha] ^
0044 [alpha]IP Y
0045 PROMPT
0046 CL[alpha]
0047 [cmplx]DROP
0048 END

Franz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Prime Factors in the ALPHA REG. - fhub - 12-09-2015, 02:33 PM
RE: Prime Factors in the ALPHA REG. - fhub - 12-09-2015 06:32 PM
RE: Prime Factors in the ALPHA REG. - fhub - 12-10-2015, 05:43 PM
RE: Prime Factors in the ALPHA REG. - fhub - 12-10-2015, 06:25 PM



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