Enigmatic Code

Programming Enigma Puzzles

Enigma 268: Missing figures

From New Scientist #1415, 2nd August 1984 [link]

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

Enigma 268

Find the correct figures.

Enigma 31 is also called “Missing figures”.

[enigma268]

Advertisements

3 responses to “Enigma 268: Missing figures

  1. Jim Randell 26 March 2015 at 7:21 am

    Another puzzle that can be fed straight to the SubstitutedDivision() solver in enigma.py.

    This Python program runs in 45ms.

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

    Solution: The correct sum is: 101815 ÷ 35 = 2909 rem 0.

    Enigma 268 - Solution

    • Jim Randell 26 March 2015 at 12:36 pm

      Here’s my non-generic solution. There are only 2560 candidates to try. It runs in 34ms.

      from itertools import product
      from enigma import irange, printf
      
      # a / b = c
      
      # c is 2?0?
      # b and b x 2 are two digits, so 9 < b < 50
      
      for (b, c2, c4) in product(irange(10, 49), irange(2, 9), irange(2, 9)):
        c = 2000 + (c2 * 100) + c4
        a = str(b * c)
        if not(len(a) == 6 and a[1] == '0' and a[3] == '8'): continue
      
        # check intermediates
      
        # b x c2 is 3??
        x = str(b * c2)
        if not(len(x) == 3 and x[0] == '3'): continue
      
        # b x c4 is ???
        x = str(b * c4)
        if not(len(x) == 3): continue
      
        printf("{a} / {b} = {c}")
      
  2. Naim Uygun 26 March 2015 at 11:48 am
    from itertools import permutations
    
    for quotient in  range(2000,3000):
        
        squotient=str(quotient)
        if squotient[2] != '0': continue
        
        for divisor in range(10,100):
            
            n=quotient*divisor
            sdividend=str(n)
            
            #if len(sdividend) != 6 : continue
            
            if sdividend[1] != '0' : continue
            if sdividend[3] != '8': continue
            
            c= str(int(squotient[1])*divisor)
            
            if c[0] != '3' or  len(c) != 3 : continue
    
            if len(str(2*divisor)) != 2: continue   
            
            print("Dividend =",sdividend,"Divisor =",divisor, "Quotient =",quotient)
            #Output : Dividend = 101815 Divisor = 35 Quotient = 2909
    

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: