The [Floyd's triangle](https://en.wikipedia.org/wiki/Floyd%27s_triangle) is a right-angled triangular array of natural numbers listing them in order, in lines of increasing length, so a Floyds triangle of size 6 looks like:

```
1
2  3
4  5  6
7  8  9  10
11 12 13 14 15
16 17 18 19 20 21
    ...
```

In this kata you're given a number, and expected to return the line number it falls in, in the Floyd's triangle

```python
nth_floyd(3) # => 2 (i.e the number `3` falls in line 2 of the triangle)
nth_floyd(17) # => 6

nth_floyd(22) # => 7
nth_floyd(499502) # => 1000
```

```python
nth_floyd(n)
```

## Constraints

### 1 <= n <= 10^(9)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Ad-hoc

Starter code: def nth_floyd(n):
	

Solutions:
def nth_floyd(n):
	return ((1 + 8 * (n - 1)) ** 0.5 + 1) // 2


from math import ceil

def nth_floyd(n):
	return ceil(((8 * n + 1) ** 0.5 - 1) / 2)


def nth_floyd(n):
	s = i = 0
	while s < n:
		i += 1
		s += i
	return i


def nth_floyd(n):
	return round((n * 2) ** 0.5)


from math import sqrt

def nth_floyd(n):
	return round(sqrt(n * 2))


def nth_floyd(n):
	sum = 0
	for x in range(1, n):
		if sum + x >= n:
			return x
		sum += x


def nth_floyd(n):
	return int((2 * n) ** 0.5 + 0.5)


def nth_floyd(n):
	i = 0
	j = 0
	while n > j:
		i += 1
		j += i
	return i


def nth_floyd(n):
	a = (n * 8 + 1) ** 0.5
	return a // 2 if a % 1 <= 1e-10 else round(a / 2)