# Ruby: 474 characters

<!-- language: lang-ruby -->

    f=->e{$><<"H1He4Li7Be9B11C12N14O16F19Ne20Na23Mg24Al27Si28P31S32Cl35Ar40K39Ca40Sc45Ti48V51Cr52Mn55Fe56Co58Ni58Cu64Zn65Ga70Ge73As75Se79Br80Kr84Rb85Sr88Y89Zr91Nb93Mo96Tc98Ru101Rh103Pd106Ag108Cd112In115Sn119Sb122Te128I127Xe131Cs133Ba137La139Ce140Pr141Nd144Pm145Sm150Eu152Gd157Tb159Dy163Ho165Er167Tm169Yb173Lu175Hf178Ta181W184Re186Os190Ir192Pt195Au197Hg201Tl204Pb207Bi209Po209At210Rn222Fr223Ra226Ac227Th232Pa231U238Np237Pu244Am243Cm247Bk247Cf251Es252Fm257".match(/#{e}(\d+)/)[1]}

Sample run:

    irb(main):001:0> f=->e{$><<"H1He4Li7Be9B11C12N14O16F19Ne20Na23Mg24Al27Si28P31S32Cl35Ar40K30Ca40Sc45Ti48V51Cr52Mn55Fe56Co58Ni58Cu64Zn65Ga70Ge73As75Se79Br80Kr84Rb85Sr88Y89Zr91Nb93Mo96Tc98Ru101Rh103Pd106Ag108Cd112In115Sn119Sb122Te128I127Xe131Cs133Ba137La139Ce140Pr141Nd144Pm145Sm150Eu152Gd157Tb159Dy163Ho165Er167Tm169Yb173Lu175Hf178Ta181W184Re186Os190Ir192Pt195Au197Hg201Tl204Pb207Bi209Po209At210Rn222Fr223Ra226Ac227Th232Pa231U238Np237Pu244Am243Cm247Bk247Cf251Es252Fm257".match(/#{e}(\d+)/)[1]}
    => #<Proc:0x0000000222e8c0@(irb):1 (lambda)>
    irb(main):002:0> f["K"]
    30=> #<IO:<STDOUT>>