You're reading: Travels in a Mathematical World

Prime Climb colouring in with LuaTeX

A while ago, my son did the Prime Climb colouring sheet.

The idea is to colour each number. Primes are given a new, single colour. Then composite numbers are broken into segments, which are coloured using the colours of their prime factors.

It came out like this.

Coloured in Prime Climb colouring sheet.

Recently, I was encouraged to try LuaTeX, which is a replacement for pdflatex that has better font support and means you can run Lua code in your LaTeX documents.

Looking for a project to try running some Lua code in a LaTeX document, and inspired by Andrew Stacey’s mention of the Sieve of Eratosthenes, I wrote some Lua code to generate TikZ code that draws grids like the one above. Here are some examples.

So now my son has a print out of my hundred grid next to the one he coloured in on his wall. He complained about my choice of colours, especially for 11.

You can look at the code I wrote on GitHub as drawing-primes – GitHub is something else new I’m trying. Oh, and I learned a bit of markdown today to write the readme file – so it’s all new coding things for me at the moment!

Leave a Reply

  • (will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Google+