Skip to content

Instantly share code, notes, and snippets.

@ryuhei-mori
ryuhei-mori / LLLguess.sage
Created July 11, 2025 06:31
Guessing a P-recursive equation via lattice basis reduction
seq = list(map(int, input().replace(',', ' ').split()))
n = len(seq)
# Parameters
r = 13
d = 2
u = n - r
mat = []
@ryuhei-mori
ryuhei-mori / bexgcd.c
Created August 18, 2020 14:43
binary extgcd
unsigned bexgcd(unsigned x, unsigned y, int *a, int *b){
int bx = __builtin_ctz(x);
int by = __builtin_ctz(y);
int u, v, w, z;
int t = 0;
int k;
unsigned xx = x >> bx;
unsigned yy = y >> by;
u = 1; v = 0; w = 0; z = 1;
if(bx >= by){
@ryuhei-mori
ryuhei-mori / vop.cpp
Last active January 4, 2020 17:34
Vertex ordering problem
#include <cstdio>
#include <algorithm>
int n, m;
int A[25];
int dp[1<<25];
int feedback_arc_set(int a, int v){
return __builtin_popcount(A[v] & a);
}
#include <cstdio>
#include <cstring>
#include <cmath>
#include <random>
#include <algorithm>
const double beta_f = 0.000001;
const double beta_l = 0.010000;
//const int iter = 20000000;