Skip to content

Instantly share code, notes, and snippets.

P.<x,y> = ZZ[]
R = P.quo((x^10 - 1, y^22 - y^21))
die = x + x^2 + x^3
f = P.hom([x*y, y])
def reduce(f):
return R.cover()(f).lift()
def next_move(p):
import Control.Monad.State
( MonadState(put, get), runState, State )
import System.IO (isEOF)
import Text.Parsec ( char, digit, (<|>), parse )
data Snailfish = Leaf Int | Branch Snailfish Snailfish
deriving (Eq)
instance Show Snailfish where
show (Leaf n) = show n
create table tweet (
id serial,
in_reply_to integer references tweet(id)
);
insert into tweet (id, in_reply_to)
values (1, NULL),
(2, NULL),
(3, 2),
(4, 3),
@robinhouston
robinhouston / README.md
Last active July 20, 2021 21:07
Parabolic flow

A flow that preserves a parabola

@robinhouston
robinhouston / gist:7f9a5bb719222a18b11205c2a2a8bf3c
Created April 14, 2021 14:13
Regex to test for divisibility by 11, in base 9
^(0|13*2|(2|13*4)(6|53*4)*(4|53*2)|(3|13*5|(2|13*4)(6|53*4)*(7|53*5))(73*5|(8|73*4)(6|53*4)*(7|53*5))*(6|73*2|(8|73*4)(6|53*4)*(4|53*2))|(4|13*6|(2|13*4)(6|53*4)*(8|53*6)|(3|13*5|(2|13*4)(6|53*4)*(7|53*5))(73*5|(8|73*4)(6|53*4)*(7|53*5))*(73*6|(8|73*4)(6|53*4)*(8|53*6)))(1|0(73*5|(8|73*4)(6|53*4)*(7|53*5))*(73*6|(8|73*4)(6|53*4)*(8|53*6)))*(8|0(73*5|(8|73*4)(6|53*4)*(7|53*5))*(6|73*2|(8|73*4)(6|53*4)*(4|53*2)))|(5|13*7|(2|13*4)(6|53*4)*53*7|(3|13*5|(2|13*4)(6|53*4)*(7|53*5))(73*5|(8|73*4)(6|53*4)*(7|53*5))*(0|73*7|(8|73*4)(6|53*4)*53*7)|(4|13*6|(2|13*4)(6|53*4)*(8|53*6)|(3|13*5|(2|13*4)(6|53*4)*(7|53*5))(73*5|(8|73*4)(6|53*4)*(7|53*5))*(73*6|(8|73*4)(6|53*4)*(8|53*6)))(1|0(73*5|(8|73*4)(6|53*4)*(7|53*5))*(73*6|(8|73*4)(6|53*4)*(8|53*6)))*(2|0(73*5|(8|73*4)(6|53*4)*(7|53*5))*(0|73*7|(8|73*4)(6|53*4)*53*7)))(4|03*7|(1|03*4)(6|53*4)*53*7|(2|03*5|(1|03*4)(6|53*4)*(7|53*5))(73*5|(8|73*4)(6|53*4)*(7|53*5))*(0|73*7|(8|73*4)(6|53*4)*53*7)|(3|03*6|(1|03*4)(6|53*4)*(8|53*6)|(2|03*5|(1|03*4)(6|53*4)*(7|53*5))(73*5|(8|73
^(0|9|[1a]8*7|(2|[1a]8*[09])(7|68*[09])*(5|68*7)|(3|[1a]8*[1a]|(2|[1a]8*[09])(7|68*[09])*(8|68*[1a]))(6|48*[1a]|(5|48*[09])(7|68*[09])*(8|68*[1a]))*(3|48*7|(5|48*[09])(7|68*[09])*(5|68*7))|(4|[1a]8*2|(2|[1a]8*[09])(7|68*[09])*(0|9|68*2)|(3|[1a]8*[1a]|(2|[1a]8*[09])(7|68*[09])*(8|68*[1a]))(6|48*[1a]|(5|48*[09])(7|68*[09])*(8|68*[1a]))*(7|48*2|(5|48*[09])(7|68*[09])*(0|9|68*2)))(5|28*2|(3|28*[09])(7|68*[09])*(0|9|68*2)|(4|28*[1a]|(3|28*[09])(7|68*[09])*(8|68*[1a]))(6|48*[1a]|(5|48*[09])(7|68*[09])*(8|68*[1a]))*(7|48*2|(5|48*[09])(7|68*[09])*(0|9|68*2)))*(1|a|28*7|(3|28*[09])(7|68*[09])*(5|68*7)|(4|28*[1a]|(3|28*[09])(7|68*[09])*(8|68*[1a]))(6|48*[1a]|(5|48*[09])(7|68*[09])*(8|68*[1a]))*(3|48*7|(5|48*[09])(7|68*[09])*(5|68*7)))|(5|[1a]8*3|(2|[1a]8*[09])(7|68*[09])*(1|a|68*3)|(3|[1a]8*[1a]|(2|[1a]8*[09])(7|68*[09])*(8|68*[1a]))(6|48*[1a]|(5|48*[09])(7|68*[09])*(8|68*[1a]))*(8|48*3|(5|48*[09])(7|68*[09])*(1|a|68*3))|(4|[1a]8*2|(2|[1a]8*[09])(7|68*[09])*(0|9|68*2)|(3|[1a]8*[1a]|(2|[1a]8*[09])(7|68*[09])*(8|68*[1a])
@robinhouston
robinhouston / output.txt
Last active October 1, 2020 10:34
Plouffe’s prime-generating constant
True 21430172143725346418968500981200036211228096234110672148875007767407021022498722449863967576313917162551893458351062936503742905713846280871969155149397149607869135549648461970842149210124742283755908364306092949967163882534797535118331087892154125829142392955373084335320859663305248773674411336138779
True 3966212458442419910671365779256433097896266098256444502994761104680485792040114698622334941551824185891729333090617747067852863746301856735596028175773861022082860675594962411634044322686894523823171200352765854123386843446869283314184698519162260023471518534376441033216641163191116687452396104764753405716908275693926617999038170654156222260226520346000668993323085068131797019884440806222984681657959124218247652049531642454130249113786478964606565384901503505452972077736233
True 45925227810970180969313328047107279360892708083547808019105709473030650455694812554266379452660250796737838585559498510937884758434522213257037254246666127415651995658124912000275511659296017948571570796025394497912646185458555
@robinhouston
robinhouston / gist:7c60f4593ea5a990564490559e40cf1e
Created September 17, 2020 11:34
Two-digit troll-square matrices
sage: for a in range(10, 92):
....: x = 101*a - a^2
....: for b in divisors(x):
....: if 10 <= b < 100 and 10 <= x//b < 100:
....: print(a, b, "|", x//b, 101 - a)
....:
10 10 | 91 91
10 13 | 70 91
10 14 | 65 91
10 26 | 35 91
import math
TABLE = {
(0, +1): (+1, True), # ()
(1, +1): (-1, False), # (0 1 2)
(2, +1): (-1, True), # (0 2 1)
(0, -1): (+1, False), # (0 1)
(1, -1): (-1, True), # (1 2)
(2, -1): (+1, True) # (0 2)
}
@robinhouston
robinhouston / output.txt
Created August 22, 2020 20:16
Search for English words that have a hex representation as a prime number
445
ABACA5
A64CA5
A84C45
4BACA5
ABAC1
484C1
46AC5
ABAF7
48AF7