Enigmatic Code

Programming Enigma Puzzles

Enigma 1530: Tom Daley

From New Scientist #2693, 31st January 2009 [link]

Before being the youngest member of the British team at the 2008 Beijing Olympics, Tom Daley had become the youngest European diving champion on record by winning the individual title from the 10-metre platform board while still aged only 13.

So it is appropriate that I can offer this puzzle:

TOM × 13 = DALEY

Each letter stands for a different digit, and no number starts with a zero.

What is the five-digit number represented by DALEY?



4 responses to “Enigma 1530: Tom Daley

  1. Jim Randell 9 July 2012 at 8:18 am

    This one is easy to brute force. Here’s my original Perl code. It runs in 9ms.

    use strict;
    my ($TOM, $DALEY);
    for $TOM (780..987) {
      $DALEY = $TOM * 13;
      next if "$TOM$DALEY" =~ /(.).*\1/;
      print "$TOM x 13 = $DALEY\n";

    Solution: DALEY = 10348.

    • Jim Randell 9 July 2012 at 8:23 am

      A similar thing in Python. It runs in 40ms.

      from enigma import irange, is_duplicate, printf
      for TOM in irange(780, 987):
        DALEY = str(TOM * 13)
        if is_duplicate(DALEY + str(TOM)): continue
        printf("DALEY={DALEY} TOM={TOM}")
      • Jim Randell 12 February 2013 at 6:56 pm

        And here’s a Python version using the SubstitutedSum class from my enigma.py module. It also runs in 40ms.

        from enigma import SubstitutedSum
        s = 'TOM x 13 = DALEY'
        p = SubstitutedSum(['TOM'] * 13, 'DALEY')
        for r in p.solve():
          print(s + ' / ' + p.substitute(r, s))
  2. Naim Uygun 9 July 2012 at 10:03 am

    The answer will be ready when you click on enter key
    if you write the expression TOM*13=DALEY
    on the site http://www.iread.it/cryptarithms.php
    in the section Cryptarithms Solve
    The answer will be seen as
    M Y T O D A L E
    6 8 7 9 1 0 3 4

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: