Skip to content

Instantly share code, notes, and snippets.

View Hermann-SW's full-sized avatar

Hermann Stamm-Wilbrandt Hermann-SW

View GitHub Profile
\\ a b c d e
\\ l m n f o
\\ k p g u v
\\ j h x r y
\\ i q w t s
\\ps=[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 61, 71, 73, 79, 83, 101, 103, 107, 109, 113];
ps=[3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 113];
used=Vec(0,25);
@Hermann-SW
Hermann-SW / srch.3x3.mpe.gp
Created November 20, 2024 13:18
Find minimal 3x3 square of distinct primes, with all row/col/diag sums being mersenne prime exponents and total sum prime
readvec("mpe.gp");
srch(P)={
my(M=oo);
my(S=[]);
my(used=Vec(0, 9*P[#P]));
my(ismpe=Vec(0,mpe[#mpe]));
foreach(mpe,p,ismpe[p]=1);
foreach(P,a,used[a]=1;
foreach(P,b,if(!used[b],used[b]=1;
@Hermann-SW
Hermann-SW / M_52.is.x^2_plus_3_times_y^2.gp
Last active November 16, 2024 12:18
Integers x,y such that biggest known (2024) Mersenne prime M_52 == x^2 + 3 * y^2
This file has been truncated, but you can view the full file.
p=2^136279841-1;
##
x=462491998679838468351042967849275787036192259652373604404366394844438073334680896098639381750886198758669121361938152658390965630163897662040480699600261616237491092827840694475425523979828812034242592764253803381791893994344762882990476102245552183922348541744024736825162210345292401587243032645873071254330015407524985396093124978787464511449076642356788802982604694474529771871150013821890312152389628850717881530903553814178599709132242069385679559321223453320994028223067352668956475536194792428805449102733474131812388933241402637312964281245075489598610830112418786790493776536939034225174698026513909064281691590070676682088986619050626660630071687469358996786719687269063841945395580098192264513610055690069517473736456092628488966516497068699950143811877440118300302554012284794023701000973478892733415138088374785565077279181531220238443155883973814141889847781291265291050973732233783643884565611909601447751211035739774707433325780412387804175791020822868285572390634595701511084409121651
@Hermann-SW
Hermann-SW / o1_edge_visitor.cpp
Created November 9, 2024 16:38
Demonstration of Boost O(1) remove_edge() in class derived from "edge_index_update_visitor"
//=======================================================================
// Copyright 2024
// Author: Hermann Stamm-Wilbrandt
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
#include <iostream>
#include <boost/graph/undirected_graph.hpp>
@Hermann-SW
Hermann-SW / M_39.gp
Created November 5, 2024 14:29
determine (fast) x,y from sqrm1, such hat M_39==x^2+3*y^2
This file has been truncated, but you can view the full file.
sqrtm3=495408778179066334892731643373106220941365568649389901427130349343368546681602611013875660113429965987134627309810542055064209288381354069735149802423870147248928683223298150605505358179659365458826775820623769142550629269327190471406049430714490316616224862227163779231525766614144886946038479723644047286542104441287258252961237160994660751873388492605879159887837065003399604049216928283663396336093823430237684094022834423015252013330295126869056279470932537661707620292481302413360013394839691036849424398562248532538904993128773625937151432196546444227039680091829185329102132054763338183267388435165336372014335150084686087953780296106458623118784206742835792890422138695157780065080765059036190468516337492350377822299095296181037805854959715592000489664637965493499043765445379488982112136058657854359881307221861230568779752285930252335198477221524300657773182993817818456947979363419034785514108657728842720340868674082328643442159148360970581206065107316363128232734600450521377031640262276482077906567060
@Hermann-SW
Hermann-SW / M_34=x^2+3*y^2.gp
Created November 4, 2024 23:12
x,y such that M_34=x^2+3*y^2
x=38068576065078340743377473667628363098529711313103681896668036561694580943104816155426321557792711384597248740197780621236511382364944450167773585269421453562184193116417255663279721847210236105674897500278612061203405041394482462393185841660118486499997714026858633267605746053919057989918276665535168624024722640508585970455915584658748744530726746893346308684626066268526618466521885335170169348910122329185693659465349383894651404286672283747373558763848948848343490133297910246930228198504572874709466059566012955582419526817006948835806864069344194108758126376375519119488386191760963998305675873428357127593908829792116856143327830832740263723322012711475972970171553675135412523135259466591738611744260926218171119015908809357725934793990913838015027340501110301691362828576129286400235639026352994299489729189317302351890255297536029894863300218541331217620832225026266859992708392399127275961649500671174129147472821363592881623094042358073037717491187256391490236167928540550637406955554761120724749275273219915
@Hermann-SW
Hermann-SW / fgqr.cpp
Created October 24, 2024 12:11
"Claude 3.5 Sonnet" created code for "Boost remove edge constant time" overall behaves quadratic
//=======================================================================
// Copyright 2024
// Author: Hermann Stamm-Wilbrandt
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
#include <iostream>
#include <boost/foreach.hpp>
@Hermann-SW
Hermann-SW / mpe.gp
Last active November 16, 2024 22:10
Mersenne prime exponents (52 sofar)
{mpe=[
2,
3,
5,
7,
13,
17,
19,
31,
61,
@Hermann-SW
Hermann-SW / is_straight_line_drawing.recreate.cpp
Created October 4, 2024 22:12
Simple planar graph on 3 vertices demonstrting that "is_straight_line_drawing()" has a bug
//=======================================================================
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/*
f=is_straight_line_drawing.recreate
g++ -O3 -Wall -pedantic -Wextra $f.cpp -o $f
cpplint --filter=-legal/copyright,-build/namespaces,-runtime/references $f.cpp
cppcheck --enable=all --suppress=missingIncludeSystem $f.cpp --check-config
*/
@Hermann-SW
Hermann-SW / 8358.cpp
Last active September 25, 2024 23:36
C++ code for CGAL issue 8359
#include <CGAL/Homogeneous.h>
#include <CGAL/Width_default_traits_3.h>
#include <CGAL/Width_3.h>
#include <iostream>
#include <cassert>
#include <vector>
typedef CGAL::Gmpz _RT;