Post Reply 
(42S) Big Factorial
12-16-2024, 03:40 PM
Post: #2
RE: (42S) Big Factorial
A quick hack to see if it could be done:
All in the stack, with an automatically growing matrix.
I add a zero to the end (right) of the carry matrix with GROW J+, positioned at the end.
I shift the carry matrix left with a DELR if the leftmost carry is zero, else I enlarge the
value matrix with an INSR, adding a zero to the left.
The 1E10 can be calculated if needed, to be as large as possible without overflowing.

00 { 70-Byte Prgm }
01▸LBL "BIG!"
02 1
03 ENTER
04 NEWMAT
05 1
06 +
07 1ᴇ10
08 X<>Y
09▸LBL 02
10 RCL ST Z
11 ×
12 RCL ST Y
13 ÷
14 ENTER
15 FP
16 STO- ST Y
17 RCL× ST Z
18 X<>Y
19 EDIT
20 J-
21 GROW
22 J+
23 I+
24 X=0?
25 GTO 00
26 EXITALL
27 X<>Y
28 EDIT
29 INSR
30 GTO 01
31▸LBL 00
32 DELR
33▸LBL 01
34 EXITALL
35 +
36 DSE ST Z
37 GTO 02
38 END


Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S) Big Factorial - Thomas Klemm - 12-15-2024, 11:39 PM
RE: (42S) Big Factorial - Werner - 12-16-2024 03:40 PM
RE: (42S) Big Factorial - Thomas Klemm - 12-16-2024, 05:38 PM
RE: (42S) Big Factorial - Nihotte(lma) - 12-19-2024, 07:38 PM
RE: (42S) Big Factorial - Thomas Klemm - 12-16-2024, 08:52 PM
RE: (42S) Big Factorial - Thomas Klemm - 12-16-2024, 10:54 PM
RE: (42S) Big Factorial - Thomas Klemm - 12-17-2024, 10:43 PM
(42S) Tree Factorial - Thomas Klemm - 12-17-2024, 11:03 PM
RE: (42S) Big Factorial - Thomas Klemm - 12-19-2024, 06:56 AM



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