Skip to content

Instantly share code, notes, and snippets.

View Hermann-SW's full-sized avatar

Hermann Stamm-Wilbrandt Hermann-SW

View GitHub Profile
@Hermann-SW
Hermann-SW / dodecahedron.js
Created September 14, 2024 20:52
JSCAD dodecahedron with exact coordinates from Wikipedia and adjacengy lists
const jscad = require('@jscad/modeling')
const { colorize } = jscad.colors
const { sphere, cylinder } = jscad.primitives
const { rotate, translate } = jscad.transforms
const { vec3 } = jscad.maths
er=0.02
function vertex(p) { return sphere({ center: p, radius: 3*er}) }
@Hermann-SW
Hermann-SW / Fibonacci_prime_indices.gp
Created August 14, 2024 14:01
Fibonacci number prime indices up to largest known sofar fibonacci prime index 201107
Fibonacci_prime_indices={[
3, 4, 5, 7, 11, 13, 17, 23, 29, 43,
47, 83, 131, 137, 359, 431, 433, 449, 509, 569,
571, 2971, 4723, 5387, 9311, 9677, 14431, 25561, 30757, 35999,
37511, 50833, 81839, 104911, 130021, 148091, 201107
]}
@Hermann-SW
Hermann-SW / challenge_sequential_vertex_coloring.cpp
Last active August 14, 2024 23:02
create planar graph that forces arbitrary k colors being used by Boost "sequential_vertex_coloring()" with default order
/*
f=challenge_sequential_vertex_coloring
g++ -O3 -Wall -Wextra -pedantic $f.cpp -o $f
cpplint --filter=-legal/copyright,-build/namespaces,-runtime/references $f.cpp
./$f 6 planar? writeLeda 2>C6.u
GraphvizFiddle.py firefox <(straight_line_graphviz C6.u)
*/
#include <boost/graph/sequential_vertex_coloring.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
@Hermann-SW
Hermann-SW / seqcol.cpp
Created July 30, 2024 10:50
Boost sequential_vertex_coloring() for evaluation on (planar) graphs
#include <fstream>
#include <boost/graph/sequential_vertex_coloring.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
using namespace boost;
template <class graphType>
void
read_leda_graph(graphType& g, char* gname) {
@Hermann-SW
Hermann-SW / 8c.u
Created July 30, 2024 10:48
22 vertices, 54 edges planar graph that makes Boost sequential_vertex_coloring() use 8 colors
LEDA.GRAPH
int
int
22
0
0
0
0
0
0
@Hermann-SW
Hermann-SW / 7c.u
Created July 30, 2024 10:47
14 vertices, 31 edges planar graph that makes Boost sequential_vertex_coloring() use 7 colors
LEDA.GRAPH
int
int
14
0
0
0
0
0
0
@Hermann-SW
Hermann-SW / miniball_int.cpp
Created July 9, 2024 20:04
Determination of convex set diameter with Miniball.hpp
#include <cstdlib>
#include <iostream>
#include <math.h>
#include "Miniball.hpp"
// from https://people.inf.ethz.ch/gaertner/subdir/software/miniball.html
/*
$ g++ miniball_int.cpp -O3 -o miniball_int
$
*/
int main (int argc, char* argv[])
@Hermann-SW
Hermann-SW / SquaresRepresentations.gp
Last active July 8, 2024 07:00
Representatins of n as sum of k squares (non-negative monotonic increasing, all, count)
assert(b)=if(!(b),error());
SquaresRepresentations(n,k,a=0)={
my(R=List(),m=sqrtint(n\k));
if(k==1,return(if(m>=a&&n==m^2,[m],[])));
for(b=a,m,foreach(SquaresRepresentations(n-b^2,k-1,b),s,listput(R,concat([b],s))));
Vec(R);
}
signs(a)={
@Hermann-SW
Hermann-SW / 131072.gp
Last active June 4, 2024 18:12
1108 Generalized Fermat prime bases with exponent 131072 from t5k.org
{[
2022202116,
1777034894,
1000032472,
399866798,
314187728,
271643232,
232050760,
231583998,
231295516,
@Hermann-SW
Hermann-SW / Fermat.gp
Last active June 29, 2024 19:50
Prime factors of Fermat numbers F0..F30
F__={[\\ needs parisizemax >= 600M; from http://www.prothsearch.com/fermat.html
[3], \\ F0
[5],
[17],
[257],
[65537],
[641, 6700417],
[274177, 67280421310721],
[59649589127497217, 5704689200685129054721],
[1238926361552897, "P62"],