In this Kata, you will be given a number `n` (`n > 0`) and your task will be to return the smallest square number `N` (`N > 0`) such that `n + N` is also a perfect square. If there is no answer, return `-1` (`nil` in Clojure, `Nothing` in Haskell, `None` in Rust). 

```clojure 
solve 13 = 36
; because 36 is the smallest perfect square that can be added to 13 to form a perfect square => 13 + 36 = 49

solve 3 = 1 ; 3 + 1 = 4, a perfect square
solve 12 = 4 ; 12 + 4 = 16, a perfect square
solve 9 = 16 
solve 4 = nil
```

```csharp 
solve(13) = 36
//because 36 is the smallest perfect square that can be added to 13 to form a perfect square => 13 + 36 = 49

solve(3) = 1 // 3 + 1 = 4, a perfect square
solve(12) = 4 // 12 + 4 = 16, a perfect square
solve(9) = 16 
solve(4) = -1
```

```haskell 
solve 13 = Just 36
-- because 36 is the smallest perfect square that can be added to 13 to form a perfect square => 13 + 36 = 49

solve 3 = Just 1 -- 3 + 1 = 4, a perfect square
solve 12 = Just 4 -- 12 + 4 = 16, a perfect square
solve 9 = Just 16 
solve 4 = Nothing
```

```python
solve(13) = 36
# because 36 is the smallest perfect square that can be added to 13 to form a perfect square => 13 + 36 = 49

solve(3) = 1 # 3 + 1 = 4, a perfect square
solve(12) = 4 # 12 + 4 = 16, a perfect square
solve(9) = 16 
solve(4) = -1
```

More examples in test cases. 

Good luck!

Source: codewars | Difficulty: EASY

Starter code: def solve(n):
	

Solutions:
def solve(n):
	for i in range(int(n ** 0.5), 0, -1):
		x = n - i ** 2
		if x > 0 and x % (2 * i) == 0:
			return ((n - i ** 2) // (2 * i)) ** 2
	return -1


def solve(n):
	answer = -1
	for D in range(1, max(int(n ** 0.5), 5)):
		R = (n - D ** 2) / (2 * D)
		if R.is_integer() and R > 0:
			answer = R ** 2
	return answer


solve = lambda n: next((((n - x * x) // 2 // x) ** 2 for x in range(int(n ** 0.5), 0, -1) if (n - x * x) % (2 * x) == 0 < n - x * x), -1)


def solve(n):
	res = float('inf')
	for x in range(1, int(n ** 0.5) + 1):
		(y, r) = divmod(n, x)
		if not (r or x == y) and y - x & 1 ^ 1:
			res = min(res, y - x >> 1)
	return -1 if res == float('inf') else res ** 2


import math

def solve(n):
	for i in range(math.ceil(n ** 0.5) - 1, 0, -1):
		if n % i == 0:
			bma = n / i - i
			if bma % 2 == 0:
				return (bma / 2) ** 2
	return -1


def solve(n):
	X = 1000000000.0
	for i in range(1, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			a = i
			b = n // i
			if b - a != 0 and (b - a) % 2 == 0:
				X = min(X, (b - a) // 2)
	return X * X if X != 1000000000.0 else -1


def solve(d):
	if d % 4 != 2:
		for i in range(1, d // 2 + 1):
			if (d + i * i) ** 0.5 % 1 == 0:
				return i * i
	return -1


def solve(n):
	if n % 2 == 0 and n % 4 != 0 or n == 1 or n == 4:
		return -1
	for i in range(n - 1):
		if (n + (i + 1) ** 2) ** 0.5 % 1 == 0:
			return (i + 1) ** 2


import math

def solve(n):
	d = math.ceil(math.sqrt(n)) - 1
	print(d)
	for a in range(d, 0, -1):
		if n % a == 0:
			e = n / a - a
			print((a, e))
			if e % 2 == 0:
				p = e / 2
				return p * p
	return -1