-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfact.bf
23 lines (21 loc) · 853 Bytes
/
fact.bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[factorial2.b -- compute factorials
(c) 2019 Daniel B. Cristofani
http://brainfuck.org/]
>>>>++>+[
[
>[>>]<[>+>]<<[>->>+<<<-]>+[
[+>>[<<+>>-]>]+[-<<+<]>-[
-[<+>>+<-]++++++[>++++++++<-]+>.[-]<<[
>>>[[<<+>+>-]>>>]<<<<[[>+<-]<-<<]>-
]>>>[
<<-[<<+>>-]<+++++++++<[
>[->+>]>>>[<<[<+>-]>>>+>>[-<]<[>]>+<]<<<<<<-
]>[-]>+>>[<<<+>>>-]>>>
]<<<+[-[+>>]<<<]>[<<<]>
]>>>[<[>>>]<<<[[>>>+<<<-]<<<]>>>>>>>-[<]>>>[<<]<<[>+>]<]<<
]++>>
]<<++++++++.+
]
This program computes the factorials (https://oeis.org/A000142). Because this
sequence is infinitely long, this program doesn't terminate on its own; you will
have to kill it. This program is much faster than my earlier factorial program.