Skip to content

Instantly share code, notes, and snippets.

View clementi's full-sized avatar
🎵
NP: Piano Sonata No. 1 in F-Sharp Minor, Op… (3:48/5:21)

Jeff Pratt clementi

🎵
NP: Piano Sonata No. 1 in F-Sharp Minor, Op… (3:48/5:21)
View GitHub Profile
(defn factorial [n]
(if (= n 0)
1
(* n (factorial (- n 1)))))
var prefixes = [
{
prefix: "",
name: ""
},
{
prefix: "Ki",
name: "kibi"
},
{
var prefixes = [
{
prefix: "",
name: ""
},
{
prefix: "Ki",
name: "kibi"
},
{
namespace Ncoa.Matching.UI
{
using System.Collections.Generic;
using System.Linq;
using StorageAccess;
public abstract class FakeQueryStorage<T> : IQueryStorage
{
protected IEnumerable<T> items;
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)
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;
var Iterable = {
func: {
predicate: {
TRUE: function (x) { return true; }
}
}
};
Array.prototype.forEach = function (fn) {
for (var i = 0; i < this.length; i++)
var Iterable = {
func: {
predicate: {
TRUE: function (x) { return true; }
}
}
};
Array.prototype.forEach = function (fn) {
for (var i = 0; i < this.length; i++)
@clementi
clementi / problem9.hs
Created January 29, 2011 04:09
Project Euler Problem 9 Solution
head [ (a, b, c) | c <- [1..], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2, a + b + c == 1000 ]
@clementi
clementi / euler-24.py
Created February 9, 2011 20:03
Project Euler Problem #24 Solution
from itertools import permutations
MILLIONTH = 10 ** 6 - 1
print reduce(lambda x, y: str(x) + str(y), list(permutations(range(10), 10))[MILLIONTH])