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
import requests | |
from lxml import html | |
def search(seq, n=10, m=10): | |
"""Search the OEIS for sequences matching seq and return a list of results. | |
Args: | |
seq: list of integers | |
n: number of results to return. | |
m: number of terms to return per result. |
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
# Author: David Beazley (https://www.dabeaz.com) | |
# Twitter: @dabeaz | |
from functools import reduce | |
run = lambda s: reduce(lambda *_:..., iter(lambda s=[s]: | |
(_:=s.pop()(),s.append(_))[0], None)) | |
const = lambda v,c : lambda: c(v) | |
add = lambda x,y,c : lambda: c(x+y) | |
mul = lambda x,y,c : lambda: c(x*y) |