Enigmatic Code

Programming Enigma Puzzles

Enigma 31: Missing figures

From New Scientist #1173, 20th September 1979 [link]

The following long division sum with most of the figures missing comes out exactly:

Enigma 31

Find the correct figures.

Enigma 268 is also called “Missing figures”.

[enigma31]

Advertisements

3 responses to “Enigma 31: Missing figures

  1. Jim Randell 2 January 2013 at 9:46 am

    The following Python program runs in 50ms.

    from enigma import irange, printf
    
    # we need a 2-digit number and a 4-digit number that multiply together
    # to give a 5-digit number: aa x bbbb = ccccc
    
    # there's no itermediate subtraction for the 10's digit of bbbb,
    # so it must be 0
    
    for aa in irange(10, 99):
      for bbb in irange(100, 999):
        bbbb = 100 * (bbb // 10) + (bbb % 10)
        ccccc = aa * bbbb
        if ccccc < 10000: continue
        if ccccc > 99999: break
    
        # the digit 2 is carried down, so must appear in the middle of ccccc
        if (ccccc // 100) % 10 != 2: continue
    
        # now examine the intermediate values
        m1 = aa * (bbbb // 1000)
        i1 = (ccccc // 1000) - m1
        if not(9 < i1 < 100): continue
    
        m2 = aa * ((bbbb // 100) % 10)
        if not(9 < m2 < 100): continue
        i2 = (10 * i1 + 2) - m2
        if not (0 < i2 < 10): continue
    
        printf("{aa} x {bbbb} = {ccccc} [{m1} {i1} {m2} {i2}]")
    

    Solution: The correct sum is 59241 ÷ 49 = 1209.

  2. Naim Uygun 2 January 2013 at 6:35 pm
    for a in range(10000,100000):
        if str(a)[2] != '2' : continue
    
        for b in range(10,100):
            if str(b)[1] =='0': continue
            c=a/b
            nc=int(c)
            if nc != c : continue
            s=str(nc)
            if len(s) != 4 : continue
            if  s.count('0')>1:continue
            if s[2] != '0': continue
            
            if (a//1000)-(nc//1000)* b< 10 : continue
            x=str(b*(c//1000))
            if len(x) != 4 : continue
    
            y=str(b*((c//100)%10))
            if len(y) != 4: continue
          
            z=str(b*(c%10))
            if len(z) !=5 : continue
            
            print("Dividend={0} Divisor={1} Quotient={2} ".format(a,nc, b))
            
    input("the end")
    
  3. Jim Randell 13 July 2014 at 9:15 am

    Or using the SubstitutedDivision() solver from the enigma.py library.

    from enigma import SubstitutedDivision
    
    SubstitutedDivision(
      '?????', '??', '????',
      [('??', '??', '??'), ('??2', '??', '?'), None, ('???', '???', '')],
      { '2': 2 }
    ).go()
    

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: