### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Enigma 544a: Merry Christ… | |

Jim Randell on Puzzle #52: Bus change | |

J. Pijnenburg on Puzzle #52: Bus change | |

Jim Randell on Puzzle #53: Painting by n… | |

GeoffR on Puzzle #52: Bus change |

### Archives

### Categories

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

### Site Stats

- 233,054 hits

I assumed the couples ages were between 16 and 112.

This Python program runs in 50ms.

Solution:The couple are aged 48 and 53 (although we don’t know which age applies to the husband and which to the setter).The transitions between the two ages are given below:

In the published solution it gives the setters ages as 48 and the husbands age as 53, but I don’t see any way to distinguish the ages.

Here are two other, and different, approaches:

1) Constraint Programming with MiniZinc: http://hakank.org/minizinc/age_changing.mzn

Note: Just few FlatZinc solvers can handle mixed var int and var floats: Gecode, JaCoP, and G12 mip. Gecode solves this in 23ms (and with symmetry breaking that “my age” <="husbands age": 5ms).

2) Picat: http://hakank.org/picat/age_changing.pi

Two variants: go/0 use string parsing and go2/0 use functional + logic approach. However, both models use non-deterministic predicate such as between/3, permute/2.

Solve time is around 200ms.