Skip to content

Instantly share code, notes, and snippets.

View timothy-shields's full-sized avatar

Timothy Shields timothy-shields

View GitHub Profile
from functools import lru_cache
def make_E(U):
@lru_cache(maxsize=None)
def memoized_E(z, t):
if z < t:
return (1.0 / 6.0) * (U(0) + sum(E(z + i, t) for i in [1, 2, 3, 4, 5]))
else:
return U(z)
def E(z, t):
return memoized_E(z, max(z, t))
@timothy-shields
timothy-shields / project.lock.json
Created October 15, 2015 16:58
aspnet/Home #990
{
"locked": false,
"version": 1,
"targets": {
"DNX,Version=v4.5.1": {
"Ix-Main/1.2.3": {
"type": "package",
"frameworkAssemblies": [
"System",
"System.Core"
int n = 11;
SortedSet<int> F = new SortedSet<int>();
while (true)
{
if (!F.Any() || F.Min > n)
{
F.Add(n);
n *= 11;
}
else
@timothy-shields
timothy-shields / gist:5193292
Last active December 15, 2015 03:19
Example of creating an advanced query using linq-cpp
#include <linqcpp/linq/Enumerable.h>
#include <string>
#include <functional>
#include <iostream>
#include <fstream>
using namespace std;
using namespace linq;