Post Reply 
(PC-1211) Prime Factor Decomposition
03-23-2021, 06:16 PM (This post was last modified: 03-23-2021 06:20 PM by C.Ret.)
Post: #3
RE: (PC-1211) Prime Factor Decomposition
Another strange line due to its useless affectation "A=A" is :
Code:
110: IF A>1LET A=A:K=K+1:A(26+K)=A:PAUSE A

Which may be replace by a shorter code:
Code:
110: IF A>1LET C=A:GOSUB 160


Memorizing all the factors is a good idea, the user just have to wait for the two 'bips' and all the factors are listed with no delay.

Here is the version of I have used in the 80's when I was a child at middle school.

Code:
1 F=F+D,P=0:IF FF>NPRINT N,"END ":END
2 Q=N/F:IF Q=INT QLET N=Q,P=P+1:GOTO 2
3 IF PPRINT F,P
4 RETURN

5 "N"AREAD N:F=1,D=1:GOSUB 1:GOSUB 1:D=2:GOSUB 1
6 GOSUB 1:D=6-D:GOTO 6

In DEF mode:
Code:
>                           129211200 [shift][ N ]
          2.          6.    [ ENTER ]
          3.          4.    [ ENTER ]
          5.          2.    [ ENTER ]
        997.END
\( 129211200 = 2^6 \times 3^4 \times 5^2 \times 997 \)

This is quite a shorter listing than the one propose by SlideRule, but the user have to wait for all factors to be displayed until the last one with the final '.END'

Also, there is no 'beeps' since they were forbidden in class and during examinations.

Also note the accelerating wheel (the D variable) which is alternatively +2 and +4 increments after factor 5.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (PC-1211) Prime Factor Decomposition - C.Ret - 03-23-2021 06:16 PM



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