### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,115)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

10 July 2017

Posted by on **From New Scientist #2263, 4th November 2000** [link]

When it comes to factor problems it is often quicker to use a bit of cunning logic than to resort to a computer or even a calculator, and here is one such puzzle.

Write down a four-figure number ending in 1 and then write down the next eight consecutive numbers, and then write down the nine numbers obtained by reversing the first nine. For example:

3721 1273 3722 2273 3723 3273 3724 4273 3725 5273 3726 6273 3727 7273 3728 8273 3729 9273You could then count how many of all those numbers have a factor greater than 1 but less than 14: in this example there are actually eleven of them.

Your task now is to find a four-figure number ending in 1 so that, when you carry out this process, fewer than half the numbers have a factor greater than 1 but less than 14.

What is that four-figure number?

[enigma1107]

Advertisements

%d bloggers like this:

Of course I used a computer program, rather than cunning logic.

This Python program performs an exhaustive search of the solution space in 67ms.

Solution:The four-figure number is 9461.Using a sieve to find candidate numbers with no small factors, and some up-front analysis to eliminate obvious multiples of 2 and 5:

A minor improvement, observing that at most 4 of the consecutive numbers can’t have a small factor (numbers ending in 2,4,5,6,8 will), and 3 of the reversed numbers are multiples of 3, so at most 6 of the reversed numbers don’t have a small factor:

The ‘start’ number takes the form abc1. As Brian says, a cannot be even; nor can it be 5, or all the reversed numbers would be multiples of 5.

Inevitably three numbers in each set are multiples of 3.

a – b + c must be 0, -1, 10, or 11, so that none of the nine in either set is a multiple of 11.

I think the condition that only one in each set is a multiple of 7 is that neither (100b + 10c – a) mod 7 nor (100c + 10b + a) mod 7 may be 5 or 6, but that probably doesn’t help us much.

At that point, logic (cunning or otherwise) deserted me.