A Long August

It’s been a bit of an eventful month for me.

My youngest son came over to visit from Sweden for the Summer. Managed to get to Universal Studios with him, last weekend. We had a lot of fun together. He’s even more of a computer addict than I am. A true Screenager.

He flew back, early Monday morning. I really miss him.

On top of that, I’m starting a new job shortly. I’ll be working for a company based in Malta, this time, coding online gambling software. Will be doing so alongside a couple of my old friends from previous jobs – Mike and Matt – who I’m really looking forward to working with again.

I’m sad to be leaving the current job – they’re a really great bunch of people – but five years is a really long time for any coder to work on just one software system.

I’m looking forward to the vertical learning curve and the new challenges ahead. Will be nice to get the Maths part of my brain whirring again. It’s been a while.

The part I’m really looking forward to, however, is that I had the new contract specially drafted to allow me to work on commercial side projects in my spare time. I already have one project lined up. Watch this space.

All in all – this is year four of living in California for me. Aside from the perma-sunshine and living ten minutes away from the ocean, my daily commute is basically me wandering downstairs to my PC in my dressing gown, every morning.

Living the dream.


So – I’ve just discovered/ rediscovered CodePen.

To celebrate – (and mostly to test out the CodePen WordPress plugin) – I threw this together:

See the Pen Matrix-style text rain by Steven Cowles (@tiggs) on CodePen.0

Because who doesn’t want some Matrix-style rain on a loading page somewhere, right?

The best thing about CodePen is that you can just jump in and start editing the code. You should totally go and make it green.

Flash Fiction – Lost Post

For Chuck Wendig’s 100 word Flash Fiction challenge, here: http://terribleminds.com/ramble/2015/03/20/flash-fiction-challenge-100-words-only/

Mary jumped through the mirror, just as the shadow hounds found her. She landed in an unfamiliar bedroom, with faded pink walls.

Twelve mirrors and still no sign of Silverwood. That was decidedly bad luck. She checked the markings etched into the bottom right of the mirror.

A West Country mirror leading to another West Country mirror. She must have found her way into some local family circuit.

The sinister growling from behind the bed moved her legs into action, and she dived through the nearby wardrobe’s mirror door with her precious cargo, the message to Ryley, still gripped tightly.

A computational hack for double factorials


In computing, multiplication is fairly expensive in terms of processing time.

This is a hack to reduce the amount of multiplication required to calculate a double factorial.

A double factorial is basically the product of a series of consecutive odd or even numbers. So 1 x 3 x 5 x 7 or 2 x 4 x 6 x 8 etc.

Pretty simple concept, strange name. Welcome to Math.

As you can see, for large series, there’s a lot of multiplication involved. Once for every term.

For multiplying any 4 numbers in this series, starting with n, you’d normally compute:

n * n+2 * n+4 * n+6

Which is three multiplications and three additions

To reduce that to two multiplications, two additions and one subtraction, use:

((n * n+6) + 4)2 – 16

Mathematical proof follows:

n * n+2 * n+4 * n+6
= (n2 + 2n) * (n2 + 10n + 24)
= n4 + 12n3 + 44n2 + 48n

((n * n+6) + 4)2
= (n2 + 6n + 4)2
= n4 + 12n3 + 44n2 + 48n + 16

Therefore, ((n * n+6) + 4)2 – 16 = n4 + 12n3 + 44n2 + 48n

Sodoku Prime – dancing the Latin Square

I’ll be the first to admit – I’m slightly obsessed with trying to come up with a solution to factor ridiculously large semiprimes. I’m not really a mathematician, so I have no hope of solving it, but its great for eating up any spare time I have.

Most of the time, I keep quiet about anything I discover on my journey. Getting from p=xy and p=s² + r to p = x² + 2x sqrt((r + (s-x)²/2x)² + 2s(r + (s-x)²/2x) -r)) might be exciting to me, but it’s hardly the stuff that makes for great dinner party conversations. Quite honestly, I’m sure it’s the sort of thing that real mathematicians crank out twice before breakfast.

Occasionally, however, I’ll stumble across something so simple and beautiful – so pure – that I feel compelled to share it with everyone.

Like the discovery that made me change the way that I felt about Prime numbers, forever.

Before, I’d always thought of Prime numbers as lonely and solitary. Numbers that were indivisible. Numbers for which there was no discernible pattern, no reason or rhyme.

As I played around with different bases, however, I noticed something quite beautiful.

To explain, let’s look at a base that everyone is familiar with – base ten.

John Napier was a mathematician, who amongst various other things five centuries or so ago, invented a device called Napier’s bones to be used in multiplication.

You probably recognise that as a version of the ten times table. What’s important, however are all the numbers under the dividing bar – or as you probably call them – the units.

Note that there’s no real pattern to their overall distribution. The number 7, for example, appears only 4 times, whilst 2 appears 12 times.

Now. Take a look at base 7.

The units for base 7 work just like a sudoku puzzle. You’ll find 1 to 6 under the bar in every line exactly once, horizontal or vertical. The mathematical name for that sudoku-like pattern is a Latin Square, and the beautiful thing that I discovered is that every base which is a prime number works exactly like that.

Prime numbers aren’t as mysterious and aloof as I imagined them to be. There is rhyme and reason to them. There is internal structure and harmony at their core.

It’s the non-prime number bases which are actually chaotic.

And that flipped my entire worldview of prime numbers totally upside down.

Why the PC will die

We are at war.

In the 3rd quarter of 2014, over 46% of computers in Russia were infected with viruses [1]. The country with the lowest infection rate – 10.5% – is Singapore [1].

Infection rate in percentage by country

We protect our own personal computers by using personal anti-virus programs, because we think of them as personal computers.

But as soon as we plug them into a network – the place where they’re most likely to contract a virus – they become just one of many interconnected nodes. A virus on one PC can spread to a virus on another and cascade, throughout the network. The health of one PC can directly affect the health of many.

We have traditionally dealt with this by protecting our own nodes, using anti-virus software written by researchers trying to single-handedly fight back the rising tide.

Eventually, a virus will arise which will use all of the resources of the computers it has infected to attack the computers it has not infected and adapt it’s programming via genetic programming [2] until it finds a way inside. Give it enough processing resources and it will adapt faster than the researchers who try to stop it.

While we rely on individual virus protection, we are doomed. Every node will eventually perish, in a computational mis-match. One by one, they will fall. Unless we react to viruses as an entire ecosystem, pooling our computing resources to take down viral attacks, we will continue to lose the war, one node at a time.

We need to realise that together, we are only as strong as our weakest links – and we need to do it before it’s too late.

We need to fundamentally rethink computing. We need to move away from personal computers and create fully-distributed (and preferably autonomic [3]) computing systems.

The age of the Personal Computer – the PC – is dying.

Long live the CC – the Cloud Computer.

 1  http://securelist.com/analysis/quarterly-malware-reports/67637/it-threat-evolution-q3-2014/
 2  http://en.wikipedia.org/wiki/Genetic_programming
 3  http://en.wikipedia.org/wiki/Autonomic_computing


The last quarter of 2014 was busy. Some of the fruits of that hard work won’t come to bear until later in 2015, if at all.

The main news is that I wrote 54,000 or so words in NaNoWriMo of a new book, which has the code name of January. I’m planning to finish the first draft and then switch between both Branch and January for the next few drafts. Hopefully, that will give me enough distance between drafts to allow myself to be as disconnected as I probably need to be whilst editing them.

Wishing you all a wonderful New Year.

Slow website development is still slow


Confirming that the new website is still taking forever to develop. I estimate that there’s about three day’s worth of work left on it. As usual, my issue is finding the time to do it.

I’ve got all of the 3D stuff more or less working. There’s a second level menu. I’ve fixed (most of) the 3D cross browser bugs.

That said – it’s still very much a work in progress. I’ve been concentrating on the trickier 3d aspects, so I don’t even have the blog post’s coming back, just yet – but if you’d like a sneak preview – you can see the latest development version here.

Flash fiction — The tyranny of numbers

[Adult themes, suicide]

The salt air stung her nostrils, as she carefully set down her purse and the signed note. A gull looked at her curiously.

Arms wide, Joan dived off the edge of the Golden Gate Bridge.

She tried to remain calm as the wind accelerated past her like a rising scream. She had been planning this for days, ever since she had found Rosen’s paper about the spiritual awakening of survivors on the internet.

Ninety eight percent of jumpers from the Golden Gate Bridge die. The two hundred and forty foot high, four second fall accelerates them to a speed of seventy five miles per hour, before they smash into the Pacific Ocean with the force of a truck hitting a brick wall.

Only ten people had ever survived the fall. David Rosen, a psychiatrist, had interviewed seven of them. Every single one had discovered on their way down that the only problem that they had which was actually unsolvable was their decision to jump off the bridge. Imminent death brought with it a sudden clarity, followed by a desperate desire to live.

For those survivors — that desire to live had stayed with them, long after the fall. It transcended everything they had ever experienced, the sheer joy of still being alive slicing through the darkest of depressions with ease.

It was their spiritual rebirth.

Joan thought it was just talk, to sell books. They all seemed to have one.

As a Maths teacher, she knew how to calculate risks. Ninety eight percent was a much higher rate of success than overdose, hanging or even a direct gunshot could promise her. Hitting the water feet-first was the only way to survive, the femurs acting as a crumple zone to protect the rest of the body.

Which meant that hitting the water head-first would guarantee her desired outcome.

She had only cared about the numbers, about their certainty. It was only now that she realised just how much of a mistake that had been, as she struggled to change direction, mid-fall.

She wanted to live.

God, she wanted…

The Pacific embraced her, like a long-lost child.

Flash fiction — Weasel

[Strong language, adult themes]

The man who had turned John’s cancer into a death sentence was on television again. Flashbulbs blazed as the Veteran Affairs Secretary strode from his office towards the parking lot, waving away a microphone from the NBC news crew.

“Weasel’s on again,” John called to Ella.

John had made a point of not remembering Weasel’s actual name. He wouldn’t give him the satisfaction.

“Fucker,” Ella said, returning from the kitchen with a Bud Light for John. They had barely spoken since her return from her weekly reading group, that afternoon.

John nodded, and held the beer can against the back of his neck. He had been running unusually hot since last Wednesday, even with the fan on full.

“What’s the latest?” she asked, sitting down on the sofa next to him.

“Another whistle blower. Saint Louis. Same thing.”

John cracked the can open.

“That’s three now?” asked Ella, absently spinning her black star-shaped necklace between right thumb and forefinger. She had taken off her father’s crucifix after John’s diagnosis.

“Yeah,” he said. “Here. Phoenix. Saint Louis.”

Ella nodded. On screen, the NBC anchor woman was talking to a young male reporter standing outside Capitol Hill.

“…Well, we just don’t know how widespread this practice is, and that’s what Congress is trying to find out. They’ve…”

Quietly, Ella started to sing to herself.

“All around the mulberry bush…”

John closed his eyes. His thighs ached. The cancer had already metastasized to the lymph nodes there. Penile cancer had an 85% survival rate, if caught early enough. He had waited two years on an invisible waiting list to see a specialist at San Antonio’s North Central Federal Clinic – a waiting list that only existed in someone’s desk drawer. By the time they had actually called him in, it was far too late. At best, they could only keep him comfortable. Survival was no longer a viable outcome.

“…called for his resignation. The Vice President, however, in a statement earlier today said that he strongly supported…”

“…The monkey chased the weasel…”

They had done this to him so that they could look good on paper. So that faceless administrators could get pats on backs for their terrific performance. They must have known, when the waiting lists were suddenly slashed overnight. The Weasel must have known, but instead of investigating, had just chosen to let John die.

“…The monkey thought it was all in good fun…”

The sudden sound of sirens caused John’s eye’s to blink open. The TV was showing live footage of a parking lot where a black Mercedes was engulfed in wildly dancing flames.

John stared at Ella, eyes wide.

“Pop goes the Weasel.”