Post Reply 
(EL-5030) Prime Factors
04-23-2022, 04:27 AM (This post was last modified: 04-23-2022 09:45 AM by C.Ret.)
Post: #9
RE: (EL-5030) Prime Factors
(04-22-2022 09:37 PM)Didier Lachieze Wrote:  This one works also with a few changes:
- Replacing Q=X/F by X/F=>Q , I=1 by 1=>I and F=0 by 0=>F
- Initializing individually each element of A[]

For 15 I get 3 and -5

Thanks for pointing out all those silly mistakes!
As I don't have an AER device, I try my code on BASIC SHARP and I accidentally mixed up codes in the notepad before copying and pasting.

Much better AER code here:
Code:
M:f(X)= #1 └►F+10*FRAC (A[I])=>F˽INT (A[I])=>I└►X/F=>Q˽F>Q =Y=>[DIM A[1]˽-X■]Q≠INT (Q)=N=>[F,Q=>X◄┐]◄┐
#1:DIM A[12]˽2.2=>A[1]˽3.1=>A[2]˽4.2=>A[3]˽5.2=>A[4]˽6.4=>A[5]˽7.2=>A[6]˽8.4=>A[7]˽9.2=>A[8]˽10.4=>A[9]˽11.6=>A[10]˽12.2=>A[11]˽5.6=>A[12]˽1=>I˽0=>F


This code is longer than it appears on the voluntarily reduced form!
I'm not sure it's shorter or faster anymore since the F>Q 'end-test' is done at each iteration; in the initial code the test X>C*C only takes place once after the 8th iteration. How much time does it save or lose?
I imagine the speed improvements will greatly depend on specific values ​​for X.

Can the sequence INT (A[I])=>I be replaced by a simpler A[I]=>I ?
Did the EL-5030 accept the reduced syntax INT A[I] or FRAC A[I] instead of INT (A[I]) or FRAC (A[I]) like the PC-1211 does?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(EL-5030) Prime Factors - Dave Britten - 04-21-2022, 03:01 PM
RE: (EL-5030) Prime Factors - Jlouis - 04-22-2022, 02:02 AM
RE: (EL-5030) Prime Factors - Dave Britten - 04-22-2022, 04:27 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-23-2022 04:27 AM
RE: (EL-5030) Prime Factors - C.Ret - 04-22-2022, 06:48 PM
RE: (EL-5030) Prime Factors - Dave Britten - 04-22-2022, 07:02 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-22-2022, 08:07 PM
RE: (EL-5030) Prime Factors - C.Ret - 04-23-2022, 05:07 PM



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