Aufbau principle - MATLAB Cody - MATLAB Central

Problem 480. Aufbau principle

Difficulty:Rate
Given the order e=[1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, 5p, 6s, 4f, 5d, 6p, 7s, 5f, 6d, 7p], find a vector x with these conditions:
  1. sum(x)==sumofx
  2. length of x is the shortest possible
  3. x has positive integers only
  4. if e(k) contains s,p,d,f,g, then x(k) must be less than 3,7,11,15,19, respectively
  5. if x(k+1)>0 then x(k) must be maximum possible.
For example, if sumofx=3 then x=[2 1]. Return x embedded in e in the following style: electrons='1s2,2s1'. Please see more info: Aufbau Principle, Electron Shell.

Solution Stats

35.37% Correct | 64.63% Incorrect
Last Solution submitted on Oct 29, 2022

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers24

Suggested Problems

More from this Author100

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!