A cryptogram (part 4B)

A B C D + E F G H I J \begin{array} { l l l l l } & & A & B \\ & & C & D \\+ & E & F & G \\ \hline & H & I & J \\ \hline \\ \end{array}

In the above equation, each of the letters A , B , C , D , E , F , G , H , I A, B, C, D, E, F, G, H, I and J J represents a different one of the digits 0, 1, 2, ..., 9.

Note that A , C , E A, C, E and H H cannot be 0.

How many possible answers for H I J \overline{HIJ} ?


The answer is 46.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

David Vreken
May 21, 2019

The following Python code finds 46 \boxed{46} possible answers for H I J HIJ .

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# cryptogram4B
# Python 2.7.3

from itertools import permutations 
p = list(permutations([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 10))
HIJlist = []
for k in range(0, len(p)):
    A = p[k][0]
    B = p[k][1]
    C = p[k][2]
    D = p[k][3]
    E = p[k][4]
    F = p[k][5]
    G = p[k][6]
    H = p[k][7]
    I = p[k][8]
    J = p[k][9]
    if A <> 0 and C <> 0 and E <> 0 and H <> 0:
        AB = 10 * A + B
        CD = 10 * C + D
        EFG = 100 * E + 10 * F + G
        HIJ = 100 * H + 10 * I + J
        if AB + CD + EFG == HIJ:
            if HIJ not in HIJlist:
                HIJlist.append(HIJ)
print "Possible answers for HIJ:", len(HIJlist)

But, isn't the length of p extensively large? i.e., 10 factorial.

Sathvik S - 1 year, 8 months ago

Log in to reply

Yes, it is 10 factorial. This method has too many possibilities for a human to through, but takes most computers only a few minutes. That's why I solved it using a computer program.

David Vreken - 1 year, 8 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...