Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [chemistry]

Related to chemistry or some aspect of chemistry

12
votes
6answers
463 views

Golf a Solubility Chart

Given the name of a cation and anion, output "S" (soluble) or "I" (insoluble). The table we will be using is from wikipedia: https://en.wikipedia.org/wiki/Solubility_chart. It is copied at the end of ...
5
votes
2answers
173 views

Find Hybridizations

Covalent bonding uses so-called "hybrid" orbitals to form tetrahedral, octahedral, etc. formations out of the s, p, and sometimes d orbitals. Their naming conventions are pretty much the concatenation ...
17
votes
7answers
884 views

Electron Configuration

In atomic physics and quantum chemistry, the electron configuration is the distribution of electrons of an atom in atomic orbitals. For example, the electron configuration of the neon atom is 1s2 2s2 ...
28
votes
8answers
2k views

Codeium Golfide

In this challenge, your task is to take an anion and a cation, and output the chemical formula of the compound. The input follows these rules: Take in 2 strings (in any order) representing the anion ...
11
votes
4answers
255 views

Degree of Unsaturation

Degree of Unsaturation This is not a particularly hard code puzzle - but I'm interested to see your multiple ways of solving it. The Degree of Unsaturation is the number of double chemical bonds ...
14
votes
10answers
2k views

Let's learn some soil pH chemistry!

Andrew is a chemist, interested in the acidity of solutions and in agriculture. After months of research (Google is not his friend), he came up with the following table* regarding the human-readable ...
12
votes
8answers
667 views

Find the Mr of a Given Compound!

Challenge Given the formula of a chemical, output the Mr of the compound. Equation Each element in the compound is followed by a number that denotes the number of said atom in the compound. If ...
8
votes
3answers
289 views

Find the Oxidation States

Challenge Find the oxidation states of each of the atoms in a given molecule. These can be output as a list or otherwise. Rules The total oxidation state of a molecule will always be zero. The ...
8
votes
1answer
341 views

Is this molecule polar?

Disclaimer It is bad practice to draw out your molecules in 2 dimensions because that is not how they are. I chose to do this in 2D because it is easier to explain. Note that the bond angles ...
9
votes
3answers
241 views

Build a Mass Spectrometer!

Challenge Given the high resolution molecular mass of an organic molecule, output the molecule's molecular formula. Explanation The input will be a single number to three decimal places of ...
12
votes
1answer
646 views

The mad chemist and the clever programmer

Backstory You wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and ...
57
votes
12answers
4k views

Output the full name of titin

Titin is a protein found in muscle tissue. It is a pretty big protein, and its full chemical name is giant as well. Comprising 189819 characters, the full name of titin would take about 3.5 hours to ...
24
votes
18answers
2k views

Chemistry 101 - Introduction to the Periodic Table

Question Given the atomic number of an element in the range [1-118] output the group and period, of that element as given by ...
21
votes
3answers
724 views

[Br]eaking Code Golf [Ba]d

Consider the following string: Tin Snips This string contains several atomic symbols on the periodic table. We could rewrite this string to identify several of ...
6
votes
1answer
203 views

Straight Chain Alk*nes without Order

This is much like my earlier challenge, except, this time, order doesn't matter. A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or ...
28
votes
20answers
1k views

Number of Straight-Chain Alk*nes of given length

A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 ...
2
votes
2answers
223 views

Check if a pattern appears in a DNA sequence

In a project I am working on, I am checking to see if certain DNA sequences appear in certain genes in E. coli. I have written a program in Java that performs the below features. However, since I ...
4
votes
5answers
305 views

Is the gas lighter than air?

Air balloons need a gas that is lighter than air. However, hydrogen is flammable, while helium is not sustainable, so we need a replacement! You must write code that determines whether any given gas ...
7
votes
1answer
182 views

Judge Some Titrations

In chemistry class, we were learning about titrations, and attempting one as a lab. We were using phenolphthalein as the indicator for the titration, so on top of grading the lab normally, my teacher ...
6
votes
2answers
204 views

Calculating dehydration synthesis results

Disclaimer: This challenge is extremely scientifically inaccurate. ;) Given an input of a list of molecules, output what the result would be if they were to all combine via dehydration synthesis, if ...
8
votes
5answers
236 views

Print The Formula

Introduction In chemistry there is a type of extension, .xyz extension,(https://en.wikipedia.org/wiki/XYZ_file_format), that prints in each line a chemical element, and the coordinates in the plane ...
12
votes
8answers
851 views

Chemical sentences! Decrypting [duplicate]

Background You are sitting in chemistry class and your friend keep sending you these strange letters. It is your job to decrypt the messages into words. This is the inverse of this challenge. The ...
2
votes
0answers
102 views

Chemical sentences! Encrypting [duplicate]

Background You are bored in class, and having exhausted all the possible things to write on a standard calculator (Like 8008135) you turn to the periodic table. You want to figure out if you can ...
15
votes
17answers
1k views

Back to the chemistry class

Introduction One of the first things I learned in chemistry, was giving the formula for the combustion of alkanes. The most basic example was: ...
17
votes
1answer
465 views

Drawing Lewis Structures of Alkanes

I just had a lesson in school about alkanes and figured it would probably make for a great code golf challenge! Don't worry, it isn't as complicated as it may look! A Quick Rehash (Please Note: To ...
11
votes
3answers
828 views

Electron Configuration Diagrams

Challenge Given an element name, output its electron configuration. Input Your input will be the full name of each element (the range being from Hydrogen, 1, to Calcium, 20) with some exceptions - ...
16
votes
4answers
461 views

An elementary challenge

This challenge is inspired by this Oliver Sacks quote: “At 11, I could say ‘I am sodium’ (Element 11), and now at 79, I am gold.” ― Oliver Sacks I want you you find numbers in a string and ...
0
votes
10answers
918 views

Energy levels of electrons [closed]

Energy levels of electrons Electrons are ordered into "shells". However, sometimes electrons get excited, for example by heat, and leave their shell to go to another! These electrons will go back at ...
29
votes
1answer
994 views

Naming non-cyclic carbon chains

(I'm not a chemist! I might be wrong at some stuff, I'm writing what I've learned in high-school) Carbon atoms have a special attribute: They can bind to 4 other atoms (which is not that special) and ...
46
votes
30answers
4k views

Element names above 118

IUPAC in their insufferable wisdom have created a systematic element name for any newly created element. This is the temporary name of an element until they finally make up their minds about an actual ...
9
votes
0answers
128 views

Find the Chemistry of a name [duplicate]

We all have knowledge of the periodic table, since our days in school. Something most of us have often tried to do is to spell out your name using elements of the table. Your challenge is to do ...
44
votes
12answers
3k views

Molecules to Atoms

The Challenge Write a program that can break down an input chemical formula (see below), and output its respective atoms in the form element: atom-count. Input ...
2
votes
1answer
5k views

VSEPR Strikes Back! [Revamped Again]

(Note: I know that the VSEPR method fails sometimes, and that there are exceptional molecules. The challenge is about the molecules which conform.) Most people who have taken an introductory ...
7
votes
1answer
371 views

Find the Formula

Introduction What you have to do is, given an an ASCII diagram of a chemical, output the chemical formula. Rules Your code must not access the internet and may not use a stored library of molecules....
33
votes
29answers
3k views

Mass of elements

There are more than 100 elements in the modern periodic table. You challenge is to output the rounded mass of an element with respect to the input given. Input Input will contain an abbreviation of ...
11
votes
5answers
466 views

Ionic Compound Golf

Challenge Given two inputs, a positive ion and a negative ion, you must output the formula for the ionic compound which would be made from the two ions. This basically means balancing out the charges ...
9
votes
3answers
856 views

“Atomic” code golf - determine the number of neutrons in an isotope

Your task is to take an string containing an isotope of an element as input, encoded like the following example with the atomic number followed by a space and the IUPAC chemical symbol for the element:...
11
votes
7answers
2k views

Longest reverse palindromic DNA substring

As you may know, in DNA there are four bases — adenine (A), cytosine (C), guanine (G) and ...
45
votes
15answers
6k views

Periodic Table of Elements - Code Golf

Based on Practical Golf - US States Your task is to find the abbreviation (symbol) of an element given the element name, up to and including ununoctium (118). Use the periodic table on Wikipedia. ...
18
votes
6answers
2k views

Electron Configurations

Electron Configurations Your mission is to accept an element's atomic number as input, and output its electron configuration (e.g. 2,8,8,2 for calcium). Input An ...
22
votes
2answers
1k views

DNA: Deoxyribonucleic ASCII

Given a sequence of the bases Adenine, Cytosine, Guanine and Thymine (encoded as ACGT), you're to produce an ASCII art representation of a corresponding double ...
13
votes
7answers
747 views

Molar masses of compounds

Task Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in ...
8
votes
4answers
835 views

Naming ionic compounds

An ionic compound is named like so: (metal name) (non-metal suffixed with -ide). Here is a list of all the suffixes that need to be replaced with ...
28
votes
6answers
6k views

Balance chemical equations!

Bernd is a high school student who has some problems in chemistry. In class he has to design chemical equations for some experiments they are doing, such as the combustion of heptane: C7H16 + 11O2 →...