Given a series 9, 33, 73, 129...  Find the n-th term of the series.
Example 1:
Input: n = 4
Output: 129
Explanation: 4th term of the 
series is 129.
Example 2:
Input: n = 5
Output: 201
Explanation: 5th term of the
series is 201.
Your Task:  
You dont need to read input or print anything. Complete the function nthOfSeries() which takes n as input parameter and returns n-th term of the series.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1<= n <=10^{4}

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3
class Solution:
    def nthOfSeries (self, n):
        # code here 

Solutions:
class Solution:

	def nthOfSeries(self, n):
		tn = 8 * n ** 2 + 1
		return tn


class Solution:

	def nthOfSeries(self, n):
		return n * (n * 8) + 1


class Solution:

	def nthOfSeries(self, n):
		return 9 + 24 * (n - 1) + 16 * (n - 1) * (n - 2) // 2


class Solution:

	def nthOfSeries(self, n):
		d = []
		for i in range(n):
			k = 8 * (i + 1) ** 2 + 1
			d.append(k)
		d.sort()
		return d[n - 1]


class Solution:

	def nthOfSeries(self, n):
		i = 1
		j = 1
		sum = 0
		while i < n + 1:
			if j % 2 != 0:
				sum = sum + j * 8
				i += 1
			j += 1
		return sum + 1


class Solution:

	def nthOfSeries(self, n):
		if n == 0:
			return 1
		sum_series = 9
		for i in range(1, n):
			diff = 24 + (i - 1) * 16
			sum_series += diff
		return sum_series


class Solution:

	def nthOfSeries(self, n):
		n = n ** 2 - 1
		ans = 9 + 8 * n
		return int(ans)


class Solution:

	def nthOfSeries(self, n):
		lst = []
		lst.append(9)
		lst.append(33)
		for i in range(1, 10000):
			a = lst[1] - lst[0]
			b = a + 16 * i + lst[i]
			lst.append(b)
		return lst[n - 1]


class Solution:

	def nthOfSeries(self, n):
		a = 24 * (n - 1)
		if n > 2:
			b = 16 * int((n - 2) * (n - 1) / 2)
		else:
			b = 0
		num = 9 + a + b
		return num


class Solution:

	def nthOfSeries(self, n):
		k = pow(n, 2)
		return 8 * k + 1


class Solution:

	def nthOfSeries(self, N):
		temp = 56
		li = [9, 33, 73, 129]
		while len(li) < N:
			li.append(li[-1] + temp + 16)
			temp = temp + 16
		if N == 0:
			return 1
		elif N <= 4:
			return li[N - 1]
		return li[-1]


class Solution:

	def nthOfSeries(self, n):
		N_th = 8 * n ** 2 + 1
		return N_th


class Solution:

	def nthOfSeries(self, n):
		(a, k) = (9, 24)
		for i in range(1, n):
			a += k
			k += 16
		return a


class Solution:

	def nthOfSeries(self, n):
		term = 9
		diff = 24
		for i in range(1, n):
			term += diff
			diff += 16
		return term


class Solution:

	def nthOfSeries(self, n):
		if n == 1:
			return 9
		return 9 + 8 * (n ** 2 - 1)


class Solution:

	def nthOfSeries(self, n):
		return (3 * n) ** 2 - (n * n - 1)


class Solution:

	def nthOfSeries(self, n):
		s = (n - 1) * (48 + (n - 2) * 16) // 2
		return 9 + s


class Solution:

	def nthOfSeries(self, n):
		if n == 1:
			return 9
		if n == 2:
			return 33
		a = 9
		b = 33
		for i in range(n - 2):
			d = b - a
			a = b
			c = b + d + 16
			b = c
		return b


class Solution:

	def nthOfSeries(self, n):
		a = 33
		b = 24
		for i in range(1, n - 1):
			b = b + 16
			a = a + b
		return a


class Solution:

	def nthOfSeries(self, n):
		a = 33
		b = 24
		for i in range(1, n - 1):
			b += 16
			a += b
		return a
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		n = n - 1
		return 8 * n * (n + 1) + 8 * n + 9
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		i = 1
		j = 1
		sum = 0
		while i < n + 1:
			if j % 2 != 0:
				sum = sum + j * 8
				i += 1
			j += 1
		return sum + 1
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		a = 9
		d = 8
		for itr in range(n):
			if itr != 0:
				a += d
			d += 16
		return a
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		s = (n - 1) * (48 + (n - 2) * 16) // 2
		return s + 9
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		result = 0
		for i in range(1, n + 1):
			result = 8 * (i * i) + 1
		return result
	if '__name__' == '__main__':
		n = int(input())
		print(nthOfSeries(n))


class Solution:

	def nthOfSeries(self, n):
		odd = 1
		s = 1
		for i in range(n):
			s += odd * 8
			odd += 2
		return s