Post Reply 
(50g) OEIS A008904: Last Non-Zero Digit of Factorial
09-09-2017, 05:54 PM
Post: #1
(50g) OEIS A008904: Last Non-Zero Digit of Factorial
For input N , a natural number, the programme returns the Nth element in the series

https://oeis.org/A008904

NB This series does NOT become periodic.

Size: 228.5

CkSum: # 3597h

Code:
::
  CK1&Dispatch
  # FF
  ::
    '
    ::
      DUP
      ZINT 2
      Z<
      casedrop
      ZINT 1
      {
        ZINT 6
        ZINT 6
        ZINT 12
        ZINT 36
        ZINT 24
        ZINT 24
        ZINT 24
        ZINT 48
        ZINT 24
        ZINT 36
      }
      OVER
      ZINT 10
      FPTR2 ^ZMod
      FPTR2 ^Z2BIN
      #1+
      NTHCOMPDROP
      ZINT 3
      ROT
      ZINT 5
      FPTR2 ^ZQUOText
      DUP4UNROLL
      ZINT 4
      FPTR2 ^ZMod
      FPTR2 ^Z2BIN
      FPTR2 ^RP#
      FPTR2 ^RMULText
      SWAP
      1GETLAM
      EVAL
      FPTR2 ^RMULText
      ZINT 10
      FPTR2 ^ZMod
    ;
    1LAMBIND
    1GETLAM
    EVAL
    ABND
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(50g) OEIS A008904: Last Non-Zero Digit of Factorial - Gerald H - 09-09-2017 05:54 PM



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