Last active
November 1, 2016 13:57
-
-
Save klrkdekira/b6b6b74971788c0927f6454bc36ff019 to your computer and use it in GitHub Desktop.
just to prove a point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def fac(n): | |
if n == 0: | |
return 0 | |
f = 0 | |
for i in reversed(xrange(n)): | |
if f == 0: | |
f = i+1 | |
continue | |
f *= i+1 | |
return f | |
if __name__ == '__main__': | |
print(fac(100000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (factorial n) | |
(define (inside n sum) | |
(if (= 0 n) sum | |
(inside (- n 1) (* n sum)))) | |
(inside n 1)) | |
(printf "~a~n" (factorial 100000)) | |
;; racket fac.rkt 5.95s user 0.33s system 95% cpu 6.556 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment