### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (94)
- teaser (7)

### Site Stats

- 233,129 hits

Programming Enigma Puzzles

12 February 2019

Posted by on **From The Sunday Times, 27th December 2015** [link]

We have a game planned for our forthcoming New Year party. Each person there will write their name on a slip of paper and the slips will be shuffled and one given to each person. If anyone gets their own slip, then all the slips will be collected up and we shall start again. When everyone has been given a name different from their own, each person will use their right hand to hold the left hand of the person named on their slip. We hope that everyone will then be forming one circle ready to sing Auld Lang Syne — but there’s a slightly less than evens chance of this happening.

How many people will there be at the party?

[teaser2779]

%d bloggers like this:

We can calculate:

and:

by recursive formulae, or we can build them up from the previous terms as we consider increasing

n.Run:[ @repl.it ]Solution:There will be 6 people at the party.I confess your formula for

d(n)is new to me.I calculated it as

subfactorial(n) = !n, otherwise writtenn¡,which is the nearest integer to

(n! / e).What looks like

niis meant to be n followed by an inverted exclamation mark. Perhaps it’s just my browser that doesn’t show it correctly.