So, its been sitting on my mental "to do" list for a couple of years and tonight, when SWMBO popped out for a couple of sherbets with the ladies from Nappy Valley, I thought I’d solve a little mathematical problem.
Each year (apart from this year) we have a Christmas celebration dinner at the Watermark in Sydney. There are four couples, my good self and SWMBO, Emma and Jon, the Executive Brain Stormer and Robyn, Richard and Belinda.
A couple of years ago the Executive Brain Stormer asked me if there was any combination of seating arrangement that ensured that no-one sat next to or opposite their partners. Well, old chap, by my calculation there are 3840 that fulfil your requirements. Don’t believe me? Here’s the code.
Its amazing what I can get up to when left at home on my own for a couple of hours.
You’ve been at the cooking sherry again, haven’t you?
from __future__ import generators?
Surely you’re running 2.3 by now?