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
(defn factorial [n] | |
(if (= n 0) | |
1 | |
(* n (factorial (- n 1))))) |
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
var prefixes = [ | |
{ | |
prefix: "", | |
name: "" | |
}, | |
{ | |
prefix: "Ki", | |
name: "kibi" | |
}, | |
{ |
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
var prefixes = [ | |
{ | |
prefix: "", | |
name: "" | |
}, | |
{ | |
prefix: "Ki", | |
name: "kibi" | |
}, | |
{ |
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
namespace Ncoa.Matching.UI | |
{ | |
using System.Collections.Generic; | |
using System.Linq; | |
using StorageAccess; | |
public abstract class FakeQueryStorage<T> : IQueryStorage | |
{ | |
protected IEnumerable<T> items; |
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
def logistic_map(x0, r, n): | |
if n == 0: | |
return x0 | |
x_prev = logistic_map(x0, r, n - 1) | |
return r * x_prev * (1 - x_prev) |
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
var prefixes = [ "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" ]; | |
const GROUP = 1024; | |
function binaryUnitFormat(x, unit) { | |
var index = 0; | |
var xnew = x; | |
while (xnew >= GROUP && index < prefixes.length - 1) { | |
xnew /= GROUP; |
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
var Iterable = { | |
func: { | |
predicate: { | |
TRUE: function (x) { return true; } | |
} | |
} | |
}; | |
Array.prototype.forEach = function (fn) { | |
for (var i = 0; i < this.length; i++) |
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
var Iterable = { | |
func: { | |
predicate: { | |
TRUE: function (x) { return true; } | |
} | |
} | |
}; | |
Array.prototype.forEach = function (fn) { | |
for (var i = 0; i < this.length; i++) |
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
head [ (a, b, c) | c <- [1..], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2, a + b + c == 1000 ] |
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
from itertools import permutations | |
MILLIONTH = 10 ** 6 - 1 | |
print reduce(lambda x, y: str(x) + str(y), list(permutations(range(10), 10))[MILLIONTH]) |
OlderNewer