This file contains hidden or 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
| (defun factorial (n) | |
| (defun i_factorial (k acc) | |
| (if (= 0 k) | |
| acc | |
| (i_factorial (- k 1) (* k acc)))) | |
| (i_factorial n 1)) | |
| (defun digits (n) | |
| (defun i_digits (k acc) | |
| (if (= 0 k) |
This file contains hidden or 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 | |
| from math import sqrt, floor | |
| N = 100000000 | |
| def is_palindrome(n): | |
| return str(n) == str(n)[::-1] | |
| def sum_list(n): |
This file contains hidden or 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 (i_factorial n acc) | |
| (if (= 0 n) | |
| acc | |
| (i_factorial (- n 1) (* n acc)))) | |
| (i_factorial n 1)) | |
| (map (lambda (n) |
This file contains hidden or 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
| (defun factorial (n) | |
| (defun i_factorial (n acc) | |
| (if (= 0 n) | |
| acc | |
| (i_factorial (- n 1) (* acc n)))) | |
| (i_factorial n 1)) | |
| (defun print-factorial (n) | |
| (format T "~D~%" (factorial n))) |
This file contains hidden or 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 | |
| from libeuler import primes | |
| if __name__ == '__main__': | |
| p = primes(7100) | |
| res = set() | |
| for s in p: | |
| for c in p: | |
| for q in p: |
This file contains hidden or 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 | |
| from libeuler import primes | |
| if __name__ == '__main__': | |
| p = primes(7100) | |
| res = set() | |
| for s in p: | |
| for c in p: | |
| for q in p: |
This file contains hidden or 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 | |
| import sys | |
| import argparse | |
| import os.path | |
| from json import dump | |
| from string import join | |
| import time | |
| import tempfile | |
| import zipfile |
This file contains hidden or 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 coffee | |
| path = require 'path' | |
| fs = require 'fs' | |
| util = require 'util' | |
| hat = require 'hat' | |
| argv = require('optimist') | |
| .usage('Usage: $0 --name <deck name> --color <card color> <directory>') | |
| .string(['name', 'color']) | |
| .demand(1) |
This file contains hidden or 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/python | |
| from operator import mul | |
| from multiprocessing import Pool, Manager | |
| manager = Manager() | |
| primes_cache = manager.list() | |
This file contains hidden or 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 period(n): | |
| a_0 = int(n ** 0.5) | |
| if a_0 * a_0 == n: | |
| return 0 | |
| b, b_0 = a_0, a_0 | |
| c, c_0 = n - a_0*a_0, n - a_0*a_0 | |
| res = 0 | |
| while True: |