[Wellington-pm] SEND + MORE = MONEY

Finlay Thompson finlay at catalyst.net.nz
Tue Mar 1 12:15:30 PST 2005


Grant

I did some guesses on paper and got 10 solutions:

   9900
 + 1199
--------
  11099

Which corresponds to { S => 9, E => 9, N=> 0, D => 0, M => 1, O => 1, R 
=> 9, Y => 9 }


However what ever we put in for D can still work, with appropriate 
changes to Y and R eg :
    990x
   +1189
--------
   1109y

where y = (x+9)-10 for any x in [1,9]


However I think you meant that no two of the numbers {S,E,N,D,M,O,R,Y} 
should be the same ?
In wich case the above solutions would not apply.

Finlay


Grant McLean wrote:

>Can anyone come up with creative solutions for this?
>
>
>Given the equation:
>
>  SEND
> +MORE
> =====
> MONEY
>
>Where each letter represents a digit (0-9) and neither S nor M can be
>zero.  Find the values for the letters which satisfy the equation.
>There is only one solution.
>
>
>I came up with a brute force approach (below) which takes nearly two
>minutes (1:50) on my workstation to check all possible answers and prove
>the assertion that there is only one answer.
>
>Cheers
>Grant
>
>
>
>Spoiler follows ...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>#!/usr/bin/perl -w
>
>use strict;
>
>my $message = 'SEND + MORE = MONEY';
>
>my @letters = sort keys %{{ map { $_, $_} ($message =~ /([A-Z])/g) }};
>
>print "$message\n";
>solve($_) foreach (0..9);
>
>sub solve {
>  my %d = map { $_, undef} (0..9);
>  delete $d{$_} foreach(@_);
>  
>  if(@_ == @letters) {
>    my $tr = join('', 'tr/', @letters, '/', @_, '/');
>    $_ = $message;
>    eval "$tr";
>    return if(/\b0/);
>    if(/^(....)...(....)...(.....)/) {
>      print "$_\n" if($1 + $2 == $3);
>    }
>    return;
>  }
>
>  solve(@_, $_) foreach keys %d;
>}
>
>
>
>_______________________________________________
>Wellington-pm mailing list
>Wellington-pm at pm.org
>http://mail.pm.org/mailman/listinfo/wellington-pm
>
>  
>



More information about the Wellington-pm mailing list