Skip to content

Instantly share code, notes, and snippets.

View james-d-mitchell's full-sized avatar

James Mitchell james-d-mitchell

View GitHub Profile
@james-d-mitchell
james-d-mitchell / todd_coxeter.py
Last active January 27, 2024 03:21
An implementation of the Todd-Coxeter Algorithm for Semigroups and Monoids in python3
#!/usr/bin/env python3
class ToddCoxeter:
def __init__(self):
self.nodes = [0]
self.edges = None
self.kappa = []
self.next_node = 1
self.R = []
#include <cassert>
#include <cmath>
#include <iostream>
#include <random>
#include <algorithm>
#include <limits>
#include <functional>
#include <map>
#include <vector>
#include <queue>
@james-d-mitchell
james-d-mitchell / gist:a5912d15aedf8eddc0aadb52989bbf53
Created May 8, 2017 16:24
GAP code for computing the number of monogenic transformation semigroups of a given degree
# Sieve of Eratosthenes based on code from
# https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Pseudocode
MyPrimes := function(n)
local A, limit, j, i;
A := BlistList([1 .. n], [2 .. n]);
limit := Int(Sqrt(Float(n)));
for i in [1 .. limit] do
if A[i] then