Enigmatic Code

Programming Enigma Puzzles

Enigma 280: A division problem

From New Scientist #1427, 25th October 1984 [link]

Enigma 280

Find the missing digits.

[enigma280]

Advertisements

One response to “Enigma 280: A division problem

  1. Jim Randell 13 May 2015 at 8:24 am

    We can use the SubstitutedDivision() solver from enigma.py to tackle this problem. The only complication is dealing with the fractional part of the result. In this instance I consider the equivalent sum with the dividend multiplied by 10.

    This Python program runs in 85ms.

    from enigma import SubstitutedDivision, printf
    
    p = SubstitutedDivision('????0', '??', '????', [('??', '7'), None, ('??4', '?8'), ('???', '')], { '7': 7, '4': 4, '8': 8, '0': 0 })
    for s in p.solve():
      (a, b) = (s.a // 10, s.b)
      (c, d) = divmod(s.c, 10)
      printf("{a} / {b} = {c}.{d}")
    

    Solution: The complete sum is shown below:

    Enigma 280 - Solution

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: