Puzzle Time

Otis

Elite Member
Joined
Apr 22, 2015
Messages
4,414
Find a six-digit number that contains no zeros, no duplicated digits and meets the following conditions.

The sixth digit doubled equals the fourth digit.

The sum of the first two digits equals the sum of the last two digits.

The sum of the fourth and sixth digits equals the fifth digit.

The sum of the first and fifth digits equals the two-digit number given by the third and fourth digits.

Please share your method; there are a number of solution strategies.

?
 
Hidden.

I'd start by labeling things

[MATH]x = a * 10^5 + b * 10^4 + c * 10^3 + d * 10^2 + e * 10^1 + f * 10^0.[/MATH]
6 unknowns

I'd start with the following 2 clues

d = 2f and e = d + f = 3f.

Now I'd look at the following clue: a + b = e + f = 3f + f = 4f.

With respect to e, there are only three positive digits that are multiples of 3, namely 3, 6, and 9.

[MATH]e = 3 \implies f = 1, \ d = 2, \text { and } a + b = = 4 * 1 = 4 \implies b = 4 - a.[/MATH]
[MATH]\text { But } a > 0,\ a \ne 1,\ a \ne 2, \text { and } a \ne 3 \implies a \ge 4 \implies b = 4 -a \le 0, \text { invalid.}[/MATH]
[MATH]e = 9 \implies f = 3, \ d = 6, \text { and } a + b = = 4 * 3 = 12 \implies b = 12 - a.[/MATH]
[MATH]e = 9 \text { and } a < 4 \implies b = 12 - a > 8 \implies b \ge 9 = e, \text {invalid.}[/MATH]
In fact e = 9 entails that a = 4 and b = 8, a = 5 and b = 7, a = 7 and b = 5, or a = 8 and b = 4. (Neither a nor b can be 6, which equals d.)

We have another clue: a + e = 10c + d, which entails a + 3 = 10c. If e = 9, a is not 4 or 5 because then a + 3 < 10, nor is a equal to 8 because then c = (8 + 3)/10, which is not an integer. If e = 9 and a = 7, then a + 3 = 10c, meaning c = 1.

So here is a possible answer

751,693.

6 = 2 * 3. Checks.

9 = 3 + 6. Checks.

7 + 5 = 12 = 9 + 3. Checks.

7 + 9 = 16 = 10 * 1 + 6. Checks.

There may be other answers. I did not test for uniqueness.
 
Last edited:
I got: 751693
My method was:
Mark up _ _ _ _ _ _ with arrows denoting the rules, to see which work well together.
Use rules 1 and 3 to find three possibilities for the last three digits (231, 462, 693).
Use rule 2 to find five possible pairs for the first two digits ({7,1},{5,3}; {7,5}, {8,4}, {9,3}) while eliminating one for the last three (231).
Use rule 4 to choose the one ordering of the first two digits that yields the correct fourth digit.
This is the only solution.
 
b c f a e d
Four pieces of information yields four equations:
a = 2d b + c = e + d a + d = e b + e = 10f +a

Using a = 2d: e = 3d b + c = 4d 10f = b + d

We now have last 3 digits in terms of d.

b c f 2d 3d d

b + c = 4d 10f = b + d
10f + 2d represents a 2 digit number which equals b + 3d - this has max possible value of 17(9 +8) since digits don’t repeat.

It follows f = 1 as f equals the number of tens in a number ≤ 17 and 0 is not a possibility.

Max possible value of d = 3 since 9 is highest digit.

Let’s try d = 3
b c 1 6 9 3
10(1) = b + 3 b = 7

b + c = 12 c = 5

Number is: 751693
 
Please share your method; there are a number of solution strategies.
The obvious approach is the system of equations technique everyone else is using.

I decided to get cheeky and cheat:
The only result is 751693. Comments omitted for the benefit of those who want to pick it apart.
JavaScript:
function bruteForce() {
    let answers = [];
    let digits  = new Array(7);

    outer: for (let number = 123456; number < 1000000; number++) {

        for (let digit = 6, temp = number; digit >= 1; digit--) {
            digits[digit] = temp % 10;

            if (digits[digit] == 0)
                continue outer;

            for (let check = digit + 1; check <= 6; check++)
                if (digits[digit] == digits[check])
                    continue outer;

            temp = Math.floor(temp / 10);
        }

        if (
            digits[6] * 2         == digits[4]             &&
            digits[1] + digits[2] == digits[5] + digits[6] &&
            digits[4] + digits[6] == digits[5]             &&
            digits[1] + digits[5] == digits[3] * 10 + digits[4]
        ) answers.push(number);
    }

    return answers;
}
Of course this approach isn't always an option, but if you just need an answer and depending on the algorithm or data set, it might be the easier or faster solution.
 
I like everyone's approach. I had started mostly along the lines of Jeff's method, and at some step I think I'd used one of the doctor's points. Good work, both.

Hoosie wrote the 4th and 5th digits in terms of the 6th and went from there. Very nice. (May I suggest writing one equation per line? ? )

Mr. Bland: In puzzle threads, I'd argue that brute-force methods are never a cheat. (Denis would have been pleased -- even more so, had you coded in BASIC.)

Cheers, all! Others are welcome to post their technique.

\(\;\)
 
Denis would have been pleased -- even more so, had you coded in BASIC.

I installed DosBox for this. I hope you're happy!
Code:
DIM DIGITS(1 TO 6) AS LONG
DIM TEMP AS LONG

FOR NUMBER = 123456 TO 987654

    TEMP = NUMBER
    FOR DIGIT = 6 TO 1 STEP -1
        DIGITS(DIGIT) = TEMP MOD 10

        IF DIGITS(DIGIT) = 0 THEN
            GOTO CONTINUE
        END IF

        FOR CHECK = DIGIT + 1 TO 6
            IF DIGITS(DIGIT) = DIGITS(CHECK) THEN
                GOTO CONTINUE
            END IF
        NEXT

        TEMP = TEMP \ 10
    NEXT

    IF _
        DIGITS(6) * 2 = DIGITS(4) AND _
        DIGITS(1) + DIGITS(2) = DIGITS(5) + DIGITS(6) AND _
        DIGITS(4) + DIGITS(6) = DIGITS(5) AND _
        DIGITS(1) + DIGITS(5) = DIGITS(3) * 10 + DIGITS(4) _
    THEN PRINT NUMBER

CONTINUE:
NEXT
Written in QBASIC 4.5, although the line continuations _ don't work in the editor. This needs to be built with BC.EXE and LINK.EXE directly. Also be sure to set cycles=max in dosbox.conf or you'll be here all day.
 
… I hope you're happy! …
I was very happy to see your first go, Mr. Bland -- it brought to mind fond memories of our late friend.

PS: I tried DOSbox once, but it was awkward. At the time, it required creating a virtual drive and changing disk designation letters/directories each time I ran it. A better way for me was Free Basic. It doesn't need the interface to run compiled programs; it runs in a console window and creates a standalone, executable file. (That all brings back memories, too, heh.)

Cheers ?
 
Top