Post Reply 
Bigs Factorials
04-11-2016, 09:07 AM
Post: #1
Bigs Factorials
Hi,
Looking a way to duplicate a routine from my 50g wich gives all digits of an factorial, yes I say : all exacts digits, I have written this pretty smart routine :

Code:

001 LBL'F'
002 IP     // To be sure it is an integer and N goes to Reg L
003 RCL L
004 DEC X
005 x=0?
006 SKIP 002
007 [times]
008 BACK 005
009 R[v]
010 RTN
011 END

But a issue occurs ! I dont' see all digits, only for instance : 108^255.
In the past I had a program wich store results in consecutives registers (HP67)
but I dont' retrieve it.

I dont' ambitious really duplicate the program because it is in machine language compiled and I dont' know this and the autor dont' give the algoritm.

May be someone have ideas to help ?

Nice day.


Attached File(s) Thumbnail(s)
   

.zip  ffac.zip (Size: 1.58 KB / Downloads: 4)

Gérard.
Find all posts by this user
Quote this message in a reply
04-11-2016, 10:33 AM
Post: #2
RE: Bigs Factorials
This will require the implementation of multiple precision arithmetic using multiple registers. If I was going to do it, I'd most likely use integer mode and take advantage of the double precision multiplication available there.


- Pauli
Find all posts by this user
Quote this message in a reply
04-11-2016, 11:07 AM
Post: #3
RE: Bigs Factorials
Hi,
I understand. I'm going to try.
Thank for your reply.

Gérard.
Find all posts by this user
Quote this message in a reply
04-11-2016, 12:34 PM (This post was last modified: 04-11-2016 12:44 PM by Dieter.)
Post: #4
RE: Bigs Factorials
(04-11-2016 09:07 AM)ggauny@live.fr Wrote:  Looking a way to duplicate a routine from my 50g wich gives all digits of an factorial, yes I say : all exacts digits, I have written this pretty smart routine :
(...)
But a issue occurs ! I dont' see all digits, only for instance : 108^255.

Sure. That's a standard factorial program that simply multiplies all integers from n down to 1. Like this one:

Code:
x=0?
INC X     // handle n=0 like n=1
#001      // set x=1 and leave n in Y
RCLx Y    // x = x*n
DSE Y     // n = n-1 and
BACK 002  // jump back as long as n>0
END

BUT: All arithmetics is done with the calculator's working precision, that is: usually 10 or 12 digits, or 16 resp. 34 on the 34s. That's all you get.

If you want more you will have to set up your own multiplication routine that returns all digits of a product, and not just the first 10, 12, 16 or 34. This is a bit tricky, but you can try the same method you would use with pencil and paper. ;-)

BTW, a simple factorial program was the very first one I ever wrote on a programmable calculator (a TI-57) or on a computer (an Apple II). ;-)

Dieter
Find all posts by this user
Quote this message in a reply
04-11-2016, 06:03 PM (This post was last modified: 04-11-2016 06:05 PM by ggauny@live.fr.)
Post: #5
RE: Bigs Factorials
Hi Dieter,

I'll try, without any warranty of I reach !

Me the first big computer I have see, in the office of Inginiers at work, was
an Olivetti Programma 101 with IBM 80 columns magnetics cards. They explain me
but it was so complicated you know !

Gérard.
Find all posts by this user
Quote this message in a reply
04-11-2016, 06:07 PM
Post: #6
RE: Bigs Factorials
But do you know the algorythm to give all digit like in my 50g ?
May be a simple flowchart ?

Gérard.
Find all posts by this user
Quote this message in a reply
04-11-2016, 06:54 PM
Post: #7
RE: Bigs Factorials
Here is an HP-42S program that does what you want:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...035#108692

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
04-12-2016, 06:53 AM
Post: #8
RE: Bigs Factorials
(04-11-2016 06:54 PM)Gerson W. Barbosa Wrote:  Here is an HP-42S program that does what you want:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...035#108692

Regards,

Gerson.

Hi,
Many thanks Gerson ! Do you know the program I've put in the other thread, in attachement, ?

Gérard.
Find all posts by this user
Quote this message in a reply
04-13-2016, 01:31 AM
Post: #9
RE: Bigs Factorials
(04-12-2016 06:53 AM)ggauny@live.fr Wrote:  
(04-11-2016 06:54 PM)Gerson W. Barbosa Wrote:  Here is an HP-42S program that does what you want:

http://www.hpmuseum.org/cgi-sys/cgiwrap/...035#108692

Regards,

Gerson.

Hi,
Many thanks Gerson ! Do you know the program I've put in the other thread, in attachement, ?

No, not yet, but thanks for posting.

Instead of picture attachments, perhaps you should try posting the links:

1. Right click on the text in the internet address field then click on Select All, then click on Copy (or the equivalent in French in your browser);

+-------------------------------------------------+
| http://www.hpcalc.org/details.php?id=6011 |
+-------------------------------------------------+

2. Click on the "Insert hyperlink" icon (the small green and blue globe & chain links);

3. Place the cursor on the highlighted "http://" then right click, click on Paste and then click on OK;

4. Optionally, enter a description for the link, for instance, "Alistair Borowski's Fast Factorial program".

Voilà ! :-)

Alistair Borowski's Fast Factorial program

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
04-13-2016, 06:37 AM
Post: #10
RE: Bigs Factorials
Hi,
Thanks for the treak.
A little bit complicated but I'm going to try for next sending !

Gérard.
Find all posts by this user
Quote this message in a reply
Post Reply 




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