### Random Post

### Recent Posts

- Enigma 1105: Road ants
- Enigma 406: The ritual
- Puzzle 69: Division: letters for digits
- Enigma 1106: Not a square unused
- Enigma 405: Uncle bungles the answer
- Enigma 401: Uncle bungles the answer
- Puzzle 70: Football five teams: new method
- Enigma 1107: Factory work
- Enigma 404: Regular timepiece
- Tantalizer 477: Precognition

### Recent Comments

Hugh Casement on Enigma 1105: Road ants | |

Jim Randell on Enigma 1105: Road ants | |

geoffrounce on Enigma 35: Digits all wro… | |

hakank on Puzzle 70: Football five teams… | |

saracogluahmet on Enigma 1740: Sudoprime |

### Archives

### Categories

- article (11)
- enigma (1,089)
- misc (2)
- project euler (2)
- puzzle (23)
- site news (42)
- tantalizer (23)
- teaser (3)

### Site Stats

- 159,510 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.