From: Dana Merrick Date: 2008-07-14T08:08:48+09:00 Subject: Re: [QUIZ] Symbolify (#169) --------------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 wor= ks and=20 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 =3D i.prime_division factors.inject("") do |string,pair| string << "(" << symbolify(pair.first) << ")**(" << symbolify(pair.l= ast) <<=20 ")*" end.chop end -Dana --=20 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 =eIuW -----END PGP SIGNATURE----- --------------enigD26D98FE69C5C3123FC36C73--