Category: Uncategorized

An unusual primality test

A few years ago, I came across The Computist Quiz, and one question in particular led to some interesting mathematics: Amphibious Discursion A predicate on positive integers: boolean isToad(int n) { return ( (n == 2) || (n == frog(4, floor((n – 1) / 2), 1, 0) – 1)); } is defined with the aid of the following helper method: int frog(int q, int r, int s, int t) { if (r < t) return 0; else if (r == t) return 1; else if (q == 0) return 0; else return (frog(q, r, s + 1, s + t) + frog(q – 1, r – t, 1, 0)); } Which integers are toads? Describe what the frog method does.

Continue reading

MazezaM is NP complete

Update 20170129: My claim that Mazezam is NP-complete is not shown by this argument. The argument does show that Mazezam is NP-hard, but it is not clear that Mazezam is itself in NP. See a follow-up post for more details. Many thanks to Aaron Williams for contacting me to point out my error. The post about AutoFickle reminded me of something I did a good while ago (2008) which doesn’t currently have a home. The connection is that this is also a project based on a game written by Malcolm Tyrrell. The game this time is MazezaM, dated 2002–2004; in it you push rows of blocks back and forth, trying to get from the entrance to the exit of a

Continue reading

Ireland’s copyright consultation

Background Ireland’s Department of Jobs, Enterprise and Innovation are in the process of conducting a review of how copyright operates in Ireland. They published a consultation document and invited submissions. The Irish Free Software Organisation made a submission, which I drafted. There were also several points about the paper which I thought were interesting, but not strictly Free Software issues: Observations on the consultation paper Neutral phrasing 2. The Intersection of Innovation and Copyright in the Submissions […] 2.2 Innovation […] […] the established film, music and news industries have struggled to find successful business models in the face of widespread infringement of the copyright in their content. [p.5] Encouraging that they don’t use words like ‘theft’ or ‘piracy’ here.

Continue reading

Making of ‘water video’

Zach of course was holding a hosepipe, which I removed using a background shot. Partly by masking off the relatively static length of hose, and the rest using bodged-together chroma-keying of the yellow of the hose. There’s next to no live sound; only Zach saying ‘I need a pee’. The swishing sound for the last shot was some sound of just spraying at a wall, then I created bass-boosted and treble-boosted versions, and mixed back and forth between them according to roughly what direction Zach was pointing the hose. Turned out OK I think. OpenShot seemed reasonable enough from the small amount I used it. It did crash once, and the dialogs for editing properties of clips were slow in

Continue reading

Solving Professor Popalop’s puzzles in Prolog

This puzzle was in my daughter’s Dandy: and I thought it would give me an opportunity to experiment with Prolog, which I’d been meaning to do for a while. I used SWI-Prolog. Structure of the puzzle We’ll represent a block of nine boxes as a list. A box is the expression X/Y/C, meaning that creature type C occupies location X/Y, where the top-left box is 1/1. We’ll have a fragment similar to Bs = [1/1/_, 1/2/_, 1/3/_, 2/1/_, 2/2/_, 2/3/_, 3/1/_, 3/2/_, 3/3/_] Our goal is to find which creature can go in each box. The different types of creature Every box must have a creature in it. box_has_creature(_/_/p). box_has_creature(_/_/h). box_has_creature(_/_/b). We’ll use the variable name ‘Bs’ throughout to mean

Continue reading