### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,972 hits

Advertisements

Programming Enigma Puzzles

30 November 2011

Posted by on **From New Scientist #2840, 26th November 2011** [link]

In a normal year, February has 28 days, April has 30 and January and May both have 31. Using letters for digits consistently, JAN and MAY are divisible by 31, APR is divisible by 30, and FEB is divisible by 28.

What is the three-digit number FEB?

[enigma1674]

Advertisements

%d bloggers like this:

It is obvious that if APR is divisible by 30 then R=0, and also if FEB is divisible by 28 then B is in {2, 4, 6, 8}.

The remaining space can be checked with a simple Python program in 120ms:

Solution:FEB = 728.Using a longer program to do more early rejection I can get the execution time down to 35ms.

Using the generalised Alphametic solver in

enigma.pywe can solve this problem directly without needing to write a program:It executes in 69ms.