--------------enigD26D98FE69C5C3123FC36C73
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Here is my solution. It's not really outstanding on any front, but it works and
it's my first Ruby Quiz submission.
def symbolify(i)
i.zero?? "??-??":"-"+("(?(-?))-"*i).chop
end
Also, I added this part for fun:
require 'mathn'
def symbolify_short(i)
return "??-??" if i.zero?
factors = i.prime_division
factors.inject("") do |string,pair|
string << "(" << symbolify(pair.first) << ")**(" << symbolify(pair.last) <<
")*"
end.chop
end
-Dana
--
Dana Merrick - System Administrator
Integrated Computer Solutions, Inc.
54B Middlesex Tpke, Bedford, MA 01730
617.621.0060 x112 - http://www.ics.com
--------------enigD26D98FE69C5C3123FC36C73
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iEYEARECAAYFAkh6jAsACgkQ7b+8UB5G/wOc/ACfc28mFEzkhBReVNNLDBNH5Tmk
8loAnj2SjuBiR6lDswcjVR3G2iTyPf5h
ßÖW
-----END PGP SIGNATURE-----
--------------enigD26D98FE69C5C3123FC36C73--