#### Task:

Your job here is to implement a function `factors`, which takes a number `n`, and outputs an array of arrays comprised of two
parts, `sq` and `cb`. The part `sq` will contain all the numbers that, when squared, yield a number which is a factor of `n`,
while the `cb` part will contain all the numbers that, when cubed, yield a number which is a factor of `n`.  Discard all `1`s
from both arrays.

Both `sq` and `cb` should be sorted in ascending order.

#### What it looks like:

```python
factors(int) #=> [
  sq (all the numbers that can be squared to give a factor of n) : list,
  cb (all the numbers that can be cubed   to give a factor of n) : list
]
```

#### Some examples:

Also check out my other creations — [Keep the Order](https://www.codewars.com/kata/keep-the-order), [Naming Files](https://www.codewars.com/kata/naming-files), [Elections: Weighted Average](https://www.codewars.com/kata/elections-weighted-average), [Identify Case](https://www.codewars.com/kata/identify-case), [Split Without Loss](https://www.codewars.com/kata/split-without-loss), [Adding Fractions](https://www.codewars.com/kata/adding-fractions),
[Random Integers](https://www.codewars.com/kata/random-integers), [Implement String#transpose](https://www.codewars.com/kata/implement-string-number-transpose), [Implement Array#transpose!](https://www.codewars.com/kata/implement-array-number-transpose), [Arrays and Procs #1](https://www.codewars.com/kata/arrays-and-procs-number-1), and [Arrays and Procs #2](https://www.codewars.com/kata/arrays-and-procs-number-2).

If you notice any issues or have any suggestions/comments whatsoever, please don't hesitate to mark an issue or just comment. Thanks!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def factors(n):
	

Solutions:
def factors(n):
	sq = [a for a in range(2, n + 1) if not n % a ** 2]
	cb = [b for b in range(2, n + 1) if not n % b ** 3]
	return [sq, cb]


def factors(n):
	sq = [i for i in range(2, int(n ** 0.5) + 2) if n % (i * i) == 0]
	cb = [i for i in range(2, int(n ** (1 / 3) + 2)) if n % (i * i * i) == 0]
	return [sq, cb]


from itertools import takewhile
squares = {i ** 2: i for i in range(2, 500)}
cubes = {i ** 3: i for i in range(2, 500)}
find = lambda n, D: [v for (k, v) in takewhile(lambda x: x[0] <= n, D.items()) if not n % k]

def factors(n):
	return [find(n, squares), find(n, cubes)]


from math import ceil

def factors(n):
	sq = [i for i in range(2, ceil(n ** (1 / 2)) + 1) if n % i ** 2 == 0]
	cb = [i for i in range(2, ceil(n ** (1 / 3)) + 1) if n % i ** 3 == 0]
	return [sq, cb]


def factors(n):
	sq = lambda x: x ** 2
	cb = lambda x: x ** 3
	return [[x for x in range(2, n) if n % sq(x) == 0], [x for x in range(2, n) if n % cb(x) == 0]]


factors = lambda n: [[d for d in range(2, int(n ** (1 / p) + 2)) if n % d ** p < 1] for p in (2, 3)]


def factors(n):
	return [[k for k in range(2, int(n ** (1 / p)) + 1) if not n % k ** p] for p in (2, 3)]


def factors(n):
	return [[d for d in range(2, int(n ** 0.5) + 1) if n % d ** 2 == 0], [d for d in range(2, int(n ** (1 / 3)) + 1) if n % d ** 3 == 0]]


def factors(n):
	divisors = [i for i in range(2, n + 1) if n % i == 0]
	sq = [x for x in divisors if x ** 2 in divisors]
	qb = [x for x in divisors if x ** 3 in divisors]
	return [sq, qb] or [[], []]


from functools import reduce

def factors(n):
	a = set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
	return [[i for i in range(2, int(n ** 0.5) + 1) if i ** 2 in a], [i for i in range(2, int(n ** 0.5) + 1) if i ** 3 in a]]