mscroggs.co.uk
mscroggs.co.uk

subscribe

Comment

Comments

Comments in green were written by me. Comments in blue were not written by me.
@Oleg: Happy new year!

I just added this:

#if 0
int last_idx_before_mid = 31 - __lzcnt32(off_mask); // 31 - LZCNT ==> index of MSb
#else

// if off_mask can never be zero, no need for check to override BSR result
assert(off_mask);
// a '9' run didn't reveal any 0 [you would know for sure for other sizes]

// need unsigned long result
unsigned long last_idx_before_mid;

// get index of MSb [no need for adjustment if off_mask can never be zero]
_BitScanReverse(&last_idx_before_mid, off_mask);
#endif

a run of '9' now produces the correct result: 1,730,280 :)
Lord Sméagol
on /blog/119
               

Archive

Show me a random blog post
 2026 

May 2026

World Cup stickers 2026

Apr 2026

A new puzzle every day
Mixing Wordle with other games

Feb 2026

Christmas (2025) is over
 2025 

Dec 2025

Christmas card 2025

Nov 2025

Christmas (2025) is coming!

Sep 2025

The partridge puzzle

Aug 2025

TMiP 2025 puzzle hunt

Jun 2025

A nonogram alphabet

Mar 2025

How to write a crossnumber

Jan 2025

Christmas (2024) is over
Friendly squares
 2024 

Dec 2024

A regular expression Christmas puzzle
Christmas card 2024

Nov 2024

Christmas (2024) is coming!

Feb 2024

Zines, pt. 2

Jan 2024

Christmas (2023) is over
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

logs christmas folding tube maps menace statistics manchester wordle platonic solids inverse matrices cambridge thirteen live stream regular expressions video games pi approximation day fonts propositional calculus logic hannah fry machine learning geogebra numbers stirling numbers gaussian elimination nonograms python go rugby ternary pac-man cross stitch ucl stickers light pizza cutting games martin gardner pascal's triangle phd estimation game show probability friendly squares signorini conditions crosswords fence posts electromagnetic field football braiding mathsteroids asteroids pythagoras mathslogicbot php hats captain scarlet kenilworth crossnumbers final fantasy finite element method crochet matrix multiplication matrix of cofactors wave scattering squares newcastle arithmetic oeis harriss spiral simultaneous equations matrices dragon curves computational complexity chalkdust magazine bots polynomials fractals news manchester science festival flexagons tennis tetris standard deviation national lottery geometry partridge puzzle puzzles pokémon chebyshev tmip data radio 4 quadrilaterals matrix of minors advent calendar accuracy crossnumber numerical analysis turtles misleading statistics kings mathsjam rhombicuboctahedron programming guest posts gather town javascript errors pi mean inline code the aperiodical raspberry pi golden spiral draughts dataset big internet math-off dinosaurs trigonometry gerry anderson hexapawn wool books people maths interpolation pokémon wordle reuleaux polygons data visualisation edinburgh a gamut of games coventry recursion reddit databet 24 hour maths countdown graphs game of life coins finite group frobel speed bluesky youtube exponential growth graph theory london underground rust sport noughts and crosses binary probability sobolev spaces weather station approximation royal institution zines latex arrangement puzzles triangles london anscombe's quartet nine men's morris plastic ratio world cup dates royal baby weak imposition boundary element methods bodmas sorting talking maths in public hyperbolic surfaces christmas card matt parker convergence error bars determinants preconditioning map projections datasaurus dozen sound correlation bubble bobble logo runge's phenomenon chess golden ratio craft folding paper curvature bempp realhats european cup palindromes alphabets warwick

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2026