## Sunday, November 1, 2009

### Periodic table puzzle

My son has homework. The task is to try to find 50 of the elements from the periodic table in this matrix of letters, whether by row or column or diagonal, backward or forward. (DISCLAIMER: I typed the puzzle in from his handout, and may have made a mistake here or there).

 `AYMR-------------------------------ASSMRNUE-------------------------------BLUEGNTN-------------------------------EIRGOOSI-------------------------------TTOSNCADMIUMN----------------DEFLUORINEHLHUAINOEOBOC----------------GHPBROMINEDAPLILOIJENLH----------------KLMUINEHTURCSPMIDNZELYO----------------PMQRTSCMUVHEOHWSAYXMDBZ----------------YDURXEUASLBLHULCRNURBDD----------------PENITIFGOHOIPREJKIORLEM----------------OENODVPRDNLQTHKNDGARTNR----------------THHNIAISIIAAHECNEDSTIUHYAHEMPERBENITATSAIAOGNLUUDNIANINIOBIUMOCLEIDETANABELEGOSCFFEAMLMTTTLINUHTNEELDEULMBORONMLENNTSSISLNDLIAGHHLUMNOBRACMISMUINITCALCIUMMUINOCRIZLTPASIMORMMMOUTUEIDBUPUTUNETTVERUEEOTUUHIENIULESULUNGCMNNRMYMMRORNTAHTUMSIBIMNMIUULMNGMIIIIEEAVUERMUIRTTYNTYIFIRIAIRIDIUMVVERUNTSECMNBMKLIUEMECHROMIUMANLTSUOXYGENMEIAHELRNICEMNMDESENAGNAMAMPSTRONTIUMRANPLTINEADANBE---------------------------PEIUGMIUARLA---------------------------OHTMAUDRMEFD---------------------------CMUAMUIMSOLD---------------------------`

After he finished, naturally, I wrote a Python script to solve this. I won't impose on you by showing the whole listing. It is here. But there are two things worth noting. First, as before, I used this trick for transposing a matrix (consisting of a list of lists). And I found a new (one-liner) trick i didn't know for reversing a string:
`>>> s = 'abcde'>>> print s[::-1]edcba`

I've never seen this before, and a search of 6 or 7 minutes did not reveal where it is documented, but it's very easy!

Are you're wondering which elements were found? I typed in 74 to look for, as indicated below. The puzzle said that it skipped some---the ones not shown in the 18-column view (lanthanoids and actinoids). I found 72.

 `ALUMINUM col fwd 10 13 ------------ALUMINUMEBLFLANTIMONY dia fwd 0 1 ANTIMONYZ---EDOTTOTHG----ARGON col fwd 0 1 ARGONAIMWLEKCINMOEGREPPOCARSENIC col rev 26 14 ----EHLMDEEHICINESRAP----ASTATINE row rev 12 19 CNEDSTIUHYAHEMPERBENITATSAIAOGNLUUDNIANBARIUM dia rev 92 8 UDUACMEMUIRAB-------D----BERYLLIUM dia fwd 3 7 OCNIZMBERYLLIUMIME----BISMUTH row rev 17 23 ESULUNGCMNNRMYMMRORNTAHTUMSIBIMNMIUULMNBORON row fwd 14 14 NUHTNEELDEULMBORONMLENNTSSISLNDLIAGHHLUBROMINE row fwd 5 29 AINOEOBOC----------------GHPBROMINEDAPLCADMIUM row fwd 4 2 NCADMIUMN----------------DEFLUORINEHLHUCALCIUM row fwd 15 17 MNOBRACMISMUINITCALCIUMMUINOCRIZLTPASIMCARBON row rev 15 2 MNOBRACMISMUINITCALCIUMMUINOCRIZLTPASIMCESIUM dia rev 106 5 ----MUISECNALSDHBESLCHLORINE dia rev 105 12 ----AIFMEOLENIROLHCPUCHROMIUM row fwd 19 19 RUNTSECMNBMKLIUEMECHROMIUMANLTSUOXYGENMCOBALT col fwd 28 16 ----LBURRIONOFLCOBALT----COPPER col rev 0 20 ARGONAIMWLEKCINMOEGREPPOCFLUORINE row fwd 4 28 NCADMIUMN----------------DEFLUORINEHLHUFRANCIUM dia rev 13 4 IUOMUICNARFDGALLIUM dia fwd 41 13 --------YENNGALLIUMEA-GERMANIUM dia fwd 89 3 UMGERMANIUMDP------------GOLD dia rev 103 20 ----GOYTRIIFOIVFAUUDLOGHAFNIUM dia fwd 39 12 ----------OHAFNIUMIYM---HELIUM col rev 1 19 YNNOCILISCJNNNUNRSMUILEHMHYDROGEN dia rev 77 2 NNEGORDYH------INDIUM dia fwd 76 1 INDIUMLLC-----IODINE col rev 3 2 RENIDOINYNIGDOTBMLITHIUMAIRIDIUM row fwd 18 30 GMIIIIEEAVUERMUIRTTYNTYIFIRIAIRIDIUMVVEIRON dia rev 6 4 IIANORIMDSIRRID----KRYPTON dia fwd 93 6 IRANEKRYPTONE------GE----LEAD dia rev 14 8 NNMLIERDAELLITHIUM col fwd 3 18 RENIDOINYNIGDOTBMLITHIUMAMAGNESIUM col rev 4 17 ----MEJZXUOASBNRMUISENGAMMANGANESE row rev 20 16 EIAHELRNICEMNMDESENAGNAMAMPSTRONTIUMRANMERCURY dia fwd 25 13 YUN-IBLO----MERCURYRN----MOLYBDENUM col fwd 7 5 ----MOLYBDENUMLMTCEMNDURMNEON dia fwd 10 2 ENEONAUCABEE---NICKEL col rev 0 10 ARGONAIMWLEKCINMOEGREPPOCNIOBIUM row fwd 13 2 INIOBIUMOCLEIDETANABELEGOSCFFEAMLMTTTLINITROGEN dia fwd 11 2 KNITROGENCBA--OSMIUM row rev 24 5 CMUAMUIMSOLD---------------------------OXYGEN row fwd 19 33 RUNTSECMNBMKLIUEMECHROMIUMANLTSUOXYGENMPALLADIUM dia rev 43 8 ------KMUIDALLAPNLVMPHOSPHORUS col rev 37 1 SUROHPSOHPTHALLIUMVNA----PLATINUM dia fwd 85 1 PLATINUMDCA------------POLONIUM dia rev 107 12 ----AMRIORDMUINOLOPPOTASSIUM col fwd 25 10 ----DGKPYPOTASSIUMIMM----RADIUM dia rev 78 1 MUIDARBBO-------RADON col rev 2 6 MUTSANODARKDEIHOMUINATITURHENIUM col fwd 38 10 MEGSULPHURHENIUMLNEMN----RUBIDIUM dia rev 91 1 MUIDIBURBNOTR------------RUTHENIUM row rev 6 28 ILOIJENLH----------------KLMUINEHTURCSPSCANDIUM dia fwd 102 11 ----ARTHEUSCANDIUMTEHTRESELENIUM dia fwd 95 1 SELENIUMTAMBI----PLPL----SILICON col rev 1 3 YNNOCILISCJNNNUNRSMUILEHMSILVER col fwd 36 16 SLITLACELIQAITHSILVER----SODIUM col fwd 33 9 ----NNTUSODIUMATIIIXI----STRONTIUM row fwd 20 28 EIAHELRNICEMNMDESENAGNAMAMPSTRONTIUMRANTANTALUM dia rev 110 8 ----SLIMULATNATRTECHNETIUM dia fwd 101 16 ----NHNAVMSSIHOTECHNETIUMTELLURIUM dia rev 96 5 OFA-MUIRULLET---YMMBU----THALLIUM col fwd 37 11 SUROHPSOHPTHALLIUMVNA----TIN row rev 9 28 LCRNURBDD----------------PENITIFGOHOIPRTITANIUM col rev 2 17 MUTSANODARKDEIHOMUINATITUTUNGSTEN dia fwd 99 9 ----SETNTUNGSTENRTNMI--BSVANADIUM col fwd 30 11 ----OONSEIVANADIUMRSO----XENON dia fwd 75 5 CNKNXENON----YTTRIUM row rev 18 14 GMIIIIEEAVUERMUIRTTYNTYIFIRIAIRIDIUMVVEZINC dia rev 3 2 OCNIZMBERYLLIUMIME----ZIRCONIUM row rev 15 24 MNOBRACMISMUINITCALCIUMMUINOCRIZLTPASIMfound 72 elementstested 74 in totalnot seen:SULFURLUTETIUM`