You are a *khm*mad*khm* scientist and you decided to play with electron distribution among atom's shells.
You know that basic idea of electron distribution is that electrons should fill a shell untill it's holding the maximum number of electrons.


  ---
Rules:  
  - Maximum number of electrons in a shell is distributed with a rule of 2n^2 (n being position of a shell). 
  - For example, maximum number of electrons in 3rd shield is 2*3^2 = 18.
  - Electrons should fill the lowest level shell first.
  - If the electrons have completely filled the lowest level shell, the other unoccupied electrons will fill the higher level shell and so on.  
  ---
        
```
Ex.:    atomicNumber(1); should return [1]
        atomicNumber(10); should return [2, 8]
        atomicNumber(11); should return [2, 8, 1]
        atomicNumber(47); should return [2, 8, 18, 19]
```

Difficulty: introductory

Starter code:

def atomic_number(electrons):
	

Solutions:
def atomic_number(electrons):
    result = []
    i = 1
    while electrons > 0:
        result.append(min(2 * (i ** 2), electrons))
        electrons -= result[-1]
        i += 1
    return result

def atomic_number(electrons):
    level, shells = 1, []
    while electrons:
        shells.append(min(2 * level * level, electrons))
        electrons, level = electrons - shells[-1], level + 1
    return shells

from numpy import roots

def atomic_number(electrons):
    root = roots((2, 3, 1, -3*electrons))[2].real
    full = int(root)
    result = [2*n*n for n in range(1, full+1)]
    if root%1: result.append(electrons - full*(full+1)*(2*full+1)//3)
    return result

def atomic_number(electrons):
    result = []
    for i in range(1, 100):
        n = 2 * i * i
        result.append(min(electrons, n))
        electrons -= n
        if electrons <= 0:
            break
    return result

def atomic_number(electrons):
    result=[]
    shield=1
    maxnum=2
    if electrons==1:
        return [1]
    while electrons>maxnum:
        result.append(maxnum)
        electrons-=maxnum
        shield+=1
        maxnum = shield ** 2 * 2
    result.append(electrons)
    return result


def atomic_number(electrons):
    res = []
    i = 1
    while True:
        m = 2 * i ** 2
        if electrons > m:
            res.append(m)
            electrons -= m
            i += 1
        else:
            res.append(electrons)
            break
    return res

def atomic_number(e, d=[], l=1):
    return d if e <= 0 else atomic_number(e-2*l**2, d + [min(e, 2*l**2)], l+1)

def atomic_number(e):
    l, shells = 1, []
    while e:
        n = min(2 * l * l, e)
        shells.append(n)
        e, l = e - n, l + 1
    return shells

def atomic_number(n):    
    L = []
    i = 1
    while n > 0:
        a = min(2*i**2, n)
        L.append(a)
        n -= a
        i += 1
    return L

def atomic_number(electrons):
    n = 1
    sa = []
    while electrons > 0:
        s = min(electrons, n ** 2 * 2)
        electrons -= s
        sa.append(s)
        n += 1
    return sa