Enigmatic Code

Programming Enigma Puzzles

Sphinx Cryptarithm #20

2 responses to “Sphinx Cryptarithm #20

  1. Jim Randell's avatarJim Randell 18 February 2026 at 8:27 am

    Here is a solution using the [[ SubstitutedExpression ]] solver from the enigma.py library.

    It runs in 80ms. (Internal runtime of the generated code is 1.1ms).

    #! python3 -m enigma -rr
    
    SubstitutedExpression
    
    #        E T E
    #        x y z
    #  -----------
    #      a b 2 1
    #    J U I N
    #    c d e
    #  -----------
    #  f g 2 h i 1
    
    --literal="12"
    --distinct="EIJNTU"
    
    "{ETE} * {xyz} = {fg2hi1}"
    
    "{ETE} * {z} = {ab21}"
    "{ETE} * {y} = {JUIN}"
    "{ETE} * {x} = {cde}"
    
    --answer="({ETE}, {xyz})"
    --output="lambda p, s, ans: output_mul(*ans, pre='  ', start='', end='')"
    

    Solution: The reconstructed sum is: 969 × 199 = 192831.

  2. ruudvanderham's avatarruudvanderham 18 February 2026 at 9:34 am
    import istr
    
    print(
        *[
            f"ETE={ETE} ABC={abc}"
            for E in istr(range(1, 10))
            for T in istr(set(range(10)) - {E})
            for a, b, c in istr.product(range(1, 10), range(10), range(10))
            if (
                len(res1 := c * (ETE := (E | T | E))) == 4
                and res1[2:] == "21"
                and len(set(E | T | (b * ETE))) == 6
                and len(a * ETE) == 3
                and len(res4 := (abc := a | b | c) * ETE) == 6
                and res4[2] == 2
                and res4[5] == 1
            )
        ]
    )
    
    

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started