(42S) Big Factorial
|
12-15-2024, 11:39 PM
Post: #1
|
|||
|
|||
(42S) Big Factorial
This program allows to calculate all digits of \(n!\):
Code: 00 { 61-Byte Prgm } Question Is there a better way to shift the elements of an array to the left? Initialisation We create an array 1 of length 10 and use 10 digits in each element. 1 ENTER 10 NEWMAT EDIT ← 1 EXIT STO "1" E 10 STO 00 Example 69 XEQ "BIG!" [ 1×10 Matrix ] 171'122'452 4'281'413'113 7'246'833'888 1'272'839'092 2'705'448'935 2'036'939'364 8'040'923'257 2'797'541'406 4'742'400'000 0 Compare this to: 69! = 171122452'4281413113'7246833888'1272839092'2705448935'2036939364'8040923257'2797541406'4742400000'0000000000 Here we use 10 digits for each element of the array. For higher values of \(n\) this needs to be reduced accordingly. The result of multiplying by \(n\) must fit into the 12 digits provided by the HP-42S. Using Free42 with its 34 decimal digits allows to calculate \(1000!\) without further adjustments. You just have to create the array 1 as a [ 1×257 Matrix ]. |
|||
« Next Oldest | Next Newest »
|
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: 1 Guest(s)