Post Reply 
(49G) OEIS A000966: n! never ends in this many 0's
09-29-2017, 07:23 AM
Post: #1
(49G) OEIS A000966: n! never ends in this many 0's
For natural number input N the programme returns the Nth element of the sequence

https://oeis.org/A000966

SIZE 356.5

CKSUM # D0A0h

Code:
«
  « DUPDUP 5 IQUOT
-
    WHILE DUPDUP 0
SWAP
      DO 5 IQUOT
DUP ROT + SWAP DUP
NOT
      UNTIL
      END DROP +
PICK3 <
    REPEAT 1 +
    END NIP
  »
  « DUP 1 <
    IF
    THEN DROP 0
    ELSE 0 SWAP
      WHILE 5 IDIV2
NOT
      REPEAT SWAP 1
+ SWAP
      END DROP
    END
  » → A B
  « DUP A EVAL DUP
B EVAL SWAP DUP 6 *
1 -
    DO SWAP 5 IQUOT
DUP UNROT + OVER
NOT
    UNTIL
    END NIP OVER
    IF
    THEN ROT -1
      DO 1 + SWAP 1
- SWAP OVER A EVAL
B EVAL NOT
      UNTIL
      END NIP +
SWAP -
    ELSE UNROT
DROP2
    END
  »
»
Find all posts by this user
Quote this message in a reply
Post Reply 




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