From: RichardOnRails=20
# My middle-school granddaughter posed the following challenge to me:

cool daughter. me, only sons, very terrible when they fight each other =
:))
=20
# Within 10 minutes, Use the digits 3 to 7 in any order
# to form a three-digit multiplicand and a two-digit multiplier
# such that their product is minimal.
# Out of curiosity as to whether my guess was right,
# and with a view toward eliciting an interest in her
# for Ruby programming,  I wrote the program posted at
# http://www.pastie.org/266447
# The program reveals that I was wrong, but it took me about 40 lines of
# code, ignoring comments.  That would probably overwhelm her.=20
# I was hoping that the code could be condensed with Ruby-isms.=20
# BTW, I left some put=92s in there
# intended to give her a sense of the programs functionality.

my try,

botp@botp-desktop:~$ cat test.rb

digits =3D [3,4,5,6,7]
min_product=3D1/0.0
min_multiplicand =3D 0
min_multiplier =3D 0

digits.permutation(3).each do |multiplicand_digits|
  h,t,ones =3D multiplicand_digits
  multiplicand =3D h*100 + t*10 + ones

  (digits-multiplicand_digits).permutation(2).each do =
|multiplier_digits|
    t,ones =3D multiplier_digits
    multiplier =3D t*10 + ones
    prod =3D multiplicand * multiplier
    if prod < min_product
       min_product =3D prod
       min_multiplicand =3D multiplicand
       min_multiplier =3D multiplier
    end
  end

end
puts "#{min_multiplicand} * #{min_multiplier} =3D #{min_product}"

botp@botp-desktop:~$ ruby test.rb
467 * 35 =3D 16345


is that ok?
kind regards -botp