Following on from [Part 1](http://www.codewars.com/kata/filling-an-array-part-1/), part 2 looks at some more complicated array contents.

So let's try filling an array with...

## ...square numbers
The numbers from `1` to `n*n`

## ...a range of numbers
A range of numbers starting from `start` and increasing by `step`

## ...random numbers
A bunch of random integers between `min` and `max`

## ...prime numbers
All primes starting from `2` (obviously)...

HOTE: All the above functions should take as their first parameter a number that determines the length of the returned array.

Difficulty: introductory

Starter code:

def squares(n):
	

Solutions:
import random
def squares(n):
    return [i**2 for i in range(1, n+1)]

def num_range(n, start, step):
    return [i for i in range(start, start+step*n, step)]

def rand_range(n, mn, mx):
    return [random.randint(mn, mx) for i in range(n)]
def primes(n):
    return [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113][:n]

from random import randint

PRIMES = [2] + [n for n in range(3, 10**3, 2) if all(n%d for d in range(3, int(n**0.5)+1, 2))]
                                                     
def squares(n):
    return [x*x for x in range(1, n+1)]

def num_range(n, start, step):
    return [start + step * i for i in range(n)]

def rand_range(n, mn, mx):
    return [randint(mn, mx) for _ in range(n)]

def primes(n):
    return PRIMES[:n]

from random import choices
from itertools import islice, count

def squares(n):
    return [a ** 2 for a in range(1, n + 1)]

def num_range(n, start, step):
    return list(islice(count(start, step), n))

def rand_range(n, mn, mx):
    return choices(range(mn, mx + 1), k = n)

def primes(n):
    return list(islice((a for a in count(2) if all(a % b != 0 for b in range(2, 1 + int(a ** 0.5)))), n))

import random

def squares(n):
        return [i*i for i in range(1,n+1)]

def num_range(n, start, step):
    return [ i for i in range(start,start+n*step,step) ]

def rand_range(n, mn, mx):
    return [ random.randint(mn, mx) for nvm in range(n) ]

def primes(n):
    if n ==1:
        return [2]
    if n ==2:
        return [2,3]
    c = 2
    ReturnLs = [2,3]
    i = 5
    while c<n:
        if isprime(i):
            ReturnLs.append(i)
            c+=1
        i+=2
    return ReturnLs
def isprime(n):
    if n%2==0:
        return False
    if n%3==0:
        return False
    for i in range(5,int(n**0.5)+1):
        if n%i==0:
            return False
    return True

def squares(n):
    return [ x**2 for x in range(1,n+1)]

def num_range(n, start, step):
    list = []
    for i in range(n):
        list.append(start)
        start+=step
    return list

import random
def rand_range(n, mn, mx):
    return [random.randint(mn, mx) for x in range(n)]

def primes(n):
    list =[]
    num=2
    while len(list)!=n:
        prime = True
        for i in range(2,num):
            if (num%i==0):
                prime = False
        if prime:
            list.append(num)
        num+=1
    return list

from random import randint

def squares(n):
    return [pow(i, 2) for i in range(1, n + 1)]

def num_range(n, start, step):
    return list(range(start, start + n * step, step))

def rand_range(n, mn, mx):
    return [randint(mn, mx) for _ in range(n)]

def primes(n):
    return gen_primes(n)

def gen_primes(size):
    
    def nats(n):
        yield n
        yield from nats(n + 1)
    
    def sieve(gen):
        n = next(gen)
        yield n 
        yield from sieve(i for i in gen if i % n != 0)
    
    prime_gen = sieve(nats(2))
    return [next(prime_gen) for _ in range(size)]

import random
def squares(n):
    return [(i*i) for i in range(1, n+1)]

def num_range(n, start, step):
    list = []
    x = 0
    for i in range(n):
        list.append(start+x)
        x += step
    return list

def rand_range(n, mn, mx):
    return [(random.randint(mn, mx)) for i in range(n)]
    
def primes(n):
    list = []
    count = 1
    s = 2
    while count <= n-1:
        s += 1
        for i in range(2, s):
            if s%i == 0:
                break
        else:
            if i == 2:
                list.append(i)
            i += 1
            list.append(i)
            count += 1
    return list


from random import choices


primes_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
               59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113]


def squares(n):
    return [i**2 for i in range(1, n+1)]

def num_range(n, start, step):
    return list(range(start, start + n*step, step))

def rand_range(n, mn, mx):
    return choices(range(mn, mx+1), k=n)

def primes(n):
    return primes_list[:n]

from random import randint


def squares(n):
    return  [i ** 2 for i in range(1, n + 1)]

def num_range(n, start, step):
    return [start + i * step for i in range(n)]

def rand_range(n, mn, mx):
    return [randint(mn, mx) for i in range(n)]

def primes(n):
    def gen_prime(arr):
        yield arr[0]
        yield from gen_prime([i for i in arr if i % arr[0] != 0])
    primes = gen_prime(range(2, n**3))
    return [next(primes) for i in range(n)]