12-05-2017, 08:11 AM
The challenge is to produce a programme that for natural number input N returns the first, ie leftmost, digit of N! on the 50g.
The programme below uses the formula here
http://mathworld.wolfram.com/StirlingsAp...ation.html
& gives correct answers for input 0 to 5,362.
The OEIS reference is here
Edit: Was wrong link.
https://oeis.org/A008905
Speed is the secondary consideration & accuracy the first.
I don't expect my programme to be bettered but would be very pleased to be proven wrong.
Size: 76.
CkSum: # 86A4h
The programme below uses the formula here
http://mathworld.wolfram.com/StirlingsAp...ation.html
& gives correct answers for input 0 to 5,362.
The OEIS reference is here
Edit: Was wrong link.
https://oeis.org/A008905
Speed is the secondary consideration & accuracy the first.
I don't expect my programme to be bettered but would be very pleased to be proven wrong.
Size: 76.
CkSum: # 86A4h
Code:
::
CK1&Dispatch
BINT1
::
%>%%
DUPDUP
%%+
%%3
%%1/
%%+
%%PI
%%*
%%SQRT
OVERDUP
%%^
ROT
%%EXP
%%/
%%*
%%.5
%%+
%%INT
DO>STR
BINT1
BINT1
SUB$
FPTR2 ^S>Z
;
;