All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Spellements (Posted on 2022-07-09) Difficulty: 3 of 5
There are currently 118 elements in the Periodic Table, each Symbol consisting of one or two letters.

Which of these elements' names can be constructed from the set of these Symbols?
Show all the ways each of these can be configured.

For example, the word "calculus" can be:
C Al C U Lu S
C Al Cu Lu S

No Solution Yet Submitted by Larry    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
This list was obtained from Wikipedia. Due to some peculiarity in the way it copied into a text file several extraneous entries occurred; I eliminated most but missed a couple, below Lead and Fermium. It had only slight effect on the output.

    "H"       "Hydrogen"     
    "He"      "Helium"       
    "Li"      "Lithium"      
    "Be"      "Beryllium"    
    "B"       "Boron"        
    "C"       "Carbon"       
    "N"       "Nitrogen"     
    "O"       "Oxygen"       
    "F"       "Fluorine"     
    "Ne"      "Neon"         
    "Na"      "Sodium"       
    "Mg"      "Magnesium"    
    "Al"      "Aluminium"    
    "Si"      "Silicon"      
    "P"       "Phosphorus"   
    "S"       "Sulfur"       
    "Cl"      "Chlorine"     
    "Ar"      "Argon"        
    "K"       "Potassium"    
    "Ca"      "Calcium"      
    "Sc"      "Scandium"     
    "Ti"      "Titanium"     
    "V"       "Vanadium"     
    "Cr"      "Chromium"     
    "Mn"      "Manganese"    
    "Fe"      "Iron"         
    "Co"      "Cobalt"       
    "Ni"      "Nickel"       
    "Cu"      "Copper"       
    "Zn"      "Zinc"         
    "Ga"      "Gallium"      
    "Ge"      "Germanium"    
    "As"      "Arsenic"      
    "Se"      "Selenium"     
    "Br"      "Bromine"      
    "Kr"      "Krypton"      
    "Rb"      "Rubidium"     
    "Sr"      "Strontium"    
    "Y"       "Yttrium"      
    "Zr"      "Zirconium"    
    "Nb"      "Niobium"      
    "Mo"      "Molybdenum"   
    "Tc"      "Technetium"   
    "Ru"      "Ruthenium"    
    "Rh"      "Rhodium"      
    "Pd"      "Palladium"    
    "Ag"      "Silver"       
    "Cd"      "Cadmium"      
    "In"      "Indium"       
    "Sn"      "Tin"          
    "Sb"      "Antimony"     
    "Te"      "Tellurium"    
    "I"       "Iodine"       
    "Xe"      "Xenon"        
    "Cs"      "Caesium"      
    "Ba"      "Barium"       
    "La"      "Lanthanum"    
    "Ce"      "Cerium"       
    "Pr"      "Praseodymium" 
    "Nd"      "Neodymium"    
    "Pm"      "Promethium"   
    "Sm"      "Samarium"     
    "Eu"      "Europium"     
    "Gd"      "Gadolinium"   
    "Tb"      "Terbium"      
    "Dy"      "Dysprosium"   
    "Ho"      "Holmium"      
    "Er"      "Erbium"       
    "Tm"      "Thulium"      
    "Yb"      "Ytterbium"    
    "Lu"      "Lutetium"     
    "Hf"      "Hafnium"      
    "Ta"      "Tantalum"     
    "W"       "Tungsten"     
    "Re"      "Rhenium"      
    "Os"      "Osmium"       
    "Ir"      "Iridium"      
    "Pt"      "Platinum"     
    "Au"      "Gold"         
    "Hg"      "Mercury"      
    "Tl"      "Thallium"     
    "Pb"      "Lead"         
    "(4+)"    "14"           
    "Bi"      "Bismuth"      
    "Po"      "Polonium"     
    "At"      "Astatine"     
    "Rn"      "Radon"        
    "Fr"      "Francium"     
    "Ra"      "Radium"       
    "Ac"      "Actinium"     
    "Th"      "Thorium"      
    "Pa"      "Protactinium" 
    "U"       "Uranium"      
    "Np"      "Neptunium"    
    "Pu"      "Plutonium"    
    "Am"      "Americium"    
    "Cm"      "Curium"       
    "Bk"      "Berkelium"    
    "Cf"      "Californium"  
    "Es"      "Einsteinium"  
    "Fm"      "Fermium"      
    "–"       "–"            
    "Md"      "Mendelevium"  
    "No"      "Nobelium"     
    "Lr"      "Lawrencium"   
    "Rf"      "Rutherfordium"
    "Db"      "Dubnium"      
    "Sg"      "Seaborgium"   
    "Bh"      "Bohrium"      
    "Hs"      "Hassium"      
    "Mt"      "Meitnerium"   
    "Ds"      "Darmstadtium" 
    "Rg"      "Roentgenium"  
    "Cn"      "Copernicium"  
    "Nh"      "Nihonium"     
    "Fl"      "Flerovium"    
    "Mc"      "Moscovium"    
    "Lv"      "Livermorium"  
    "Ts"      "Tennessine"   
    "Og"      "Oganesson"    
    
The program:    
    
clearvars,clc
global names symbols build
fid=fopen('c:\vb5 projects\flooble\chemical elements.txt','r');
names=string.empty; symbols=string.empty;
while ~feof(fid)
  l=fgetl(fid);
  f=find(l==' ');
  symbols(end+1)=string(l(f(1)+1:f(2)-1));
  names(end+1)=string(l(f(2)+1:f(3)-1));
  if names(end)==""
    names(end)=[];
    symbols(end)=[];
  end
end
fclose(fid);

for i=1:length(names)
  build='';
  addon(i,1);
end

function addon(i,wh)
 global names symbols build
  if wh==1
    build='';
  end
  rest= lower(extractBetween(names(i),wh,length(char(names(i)))));
  for j=1:length(symbols)
    trial= lower(symbols(j));
    f=strfind(rest,trial);
    if ~isempty(f)
      if f(1)==1
        build=[ build char(symbols(j))];
        if length(build)==strlength(names(i))
          for k=1:length(build)
            if build(k)==upper(build(k))
              fprintf('%s',' ');
            end
            fprintf('%s',build(k))
          end
          fprintf('\n')
        else
          addon(i,wh+strlength(trial));
        end
        build=extractBefore(build,length(build)-strlength(trial)+1);
      end
    end
  end
end    

the result:

 C Ar B O N
 Ca Rb O N
 Ne O N
 Si Li C O N
 Si Li Co N
 S I Li C O N
 S I Li Co N
 P H O S P H O Ru S
 P H O S P Ho Ru S
 P H Os P H O Ru S
 P H Os P Ho Ru S
 P Ho S P H O Ru S
 P Ho S P Ho Ru S
 Ir O N
 C O P P Er
 Co P P Er
 Ar Se N I C
 Ar Se Ni C
 Kr Y Pt O N
 Si Lv Er
 S I Lv Er
 Ti N
 Xe N O N
 Xe No N
 B I Sm U Th
 Bi Sm U Th
 As Ta Ti Ne
 –
 Te N N Es Si Ne
 Te N N Es S I Ne
 Te N Ne S Si Ne
 Te N Ne S S I Ne
 O Ga N Es S O N
 O Ga Ne S S O N

  Posted by Charlie on 2022-07-09 12:08:29
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information