Given the value of n, we need to find the sum of the series where i-th term is sum of first i odd natural numbers.
NOTE: Sum of the series 1 + (1+3) + (1+3+5) + (1+3+5+7) + …… + (1+3+5+7+…+(2n-1))
Example 1:
Input: n = 2
Output: 5 
Explanation: 1 + (1+3) = 5
Hence sum of the series is 5.
Example 2:
Input: n = 5
Output: 55
Explanation: 1 + (1+3) + (1+3+5) +
(1+3+5+7) + (1+3+5+7+9) = 55.
Hence sum of the series is 55.
Your Task:  
You dont need to read input or print anything. Complete the function sumOfTheSeries() which takes n as input parameter and returns the sum of the series of n terms.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
1<= n <=1000

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

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

Solutions:
class Solution:

	def sumOfTheSeries(self, n):
		c = 0
		for i in range(1, n + 1, 1):
			c += i * i
		return c


class Solution:

	def sumOfTheSeries(self, n):
		return int(n * (n + 1) * (2 * n + 1) / 6)


class Solution:

	def sumOfTheSeries(self, n):
		k = 0
		j = 0
		for i in range(n):
			k += 2 * i + 1
			j += k
		return j


class Solution:

	def sumOfTheSeries(self, n):
		a2 = n * (n + 1) * (2 * n + 1) // 6
		return a2


class Solution:

	def sumOfTheSeries(self, n):
		i = n * (n + 1) * (2 * n + 1)
		return i // 6


class Solution:

	def sumOfTheSeries(self, n):
		sum = 0
		for i in range(1, n + 1):
			sum += i ** 2
		return sum


class Solution:

	def sumOfTheSeries(self, n):
		ans = n * (n + 1) * (2 * n + 1) // 6
		return ans


class Solution:

	def sumOfTheSeries(self, n):
		if n == 1:
			return 1
		else:
			return n ** 2 + self.sumOfTheSeries(n - 1)


class Solution:

	def sumOfTheSeries(self, n):
		x = (n + 1) * n * (2 * n + 1) // 6
		return x


class Solution:

	def sumOfTheSeries(self, n):
		if n == 1:
			return 1
		(ans, even, sum_) = (1, 3, 1)
		for i in range(1, n):
			sum_ += even
			ans += sum_
			even += 2
		return ans


class Solution:

	def sumOfTheSeries(self, n):
		l = []
		l1 = []
		for i in range(1, n * 2):
			if i % 2 == 1:
				l.append(i)
		for k in range(1, len(l) + 1):
			l1.append(sum(l[0:k]))
		return sum(l1)


class Solution:

	def sumOfTheSeries(self, n):
		return int(n * (n + 1) / 2 * (2 * n + 1) / 3)


class Solution:

	def sumOfTheSeries(self, n):
		return n * (n + 1) * (2 * n + 1) // 6
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.sumOfTheSeries(n))


class Solution:

	def sumOfTheSeries(self, n):
		s = 0
		for i in range(1, n + 1):
			s += i * i
		return s
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		n = int(input())
		ob = Solution()
		print(ob.sumOfTheSeries(n))


class Solution:

	def sumOfTheSeries(s, n):
		sum = 0
		for i in range(1, n + 1):
			sum = sum + i * i
		return sum


class Solution:

	def sumOfTheSeries(self, n):
		u = []
		for i in range(1, n + 1):
			u.append(i * i)
		return sum(u)


class Solution:

	def sumOfTheSeries(self, n):
		s = 0
		k = 1
		p = 0
		while n > 0:
			s = s + k
			p = p + s
			k = k + 2
			n = n - 1
		return p


class Solution:

	def sumOfTheSeries(self, n):
		c = 0
		a = 1
		for i in range(n):
			s = 2 * 1 + (a - 1) * 2
			s1 = s * a // 2
			a += 1
			c = c + s1
		return c


class Solution:

	def sumOfTheSeries(self, n):
		ls = []
		res = 0
		for i in range(n):
			res += i * 2 + 1
			ls.append(res)
		return sum(ls)


class Solution:

	def sumOfTheSeries(self, n):
		s = 0
		for x in range(1, n + 1):
			s += x ** 2
		return s


class Solution:

	def sumOfTheSeries(self, n):
		s = 0
		count = 0
		for i in range(1, n * 2 + 1, 2):
			s += i
			count += s
		return count


class Solution:

	def sumOfTheSeries(self, n):
		sum1 = 0
		count = 0
		i = 1
		while i <= n * 2:
			sum1 = sum1 + i
			count = count + sum1
			i = i + 2
		return count


class Solution:

	def sumOfTheSeries(self, n):
		m = n + 1
		k = 2 * n + 1
		j = n * m * k / 6
		return int(j)


class Solution:

	def sumOfTheSeries(self, n):
		sq = 2
		m = 2
		h = 0
		sum_ = 1
		while m <= n:
			sum_ += (sq + h) ** 2
			m += 1
			h += 1
		return sum_


class Solution:

	def dosum(self, num):
		return int(num / 2 * (2 * 1 + (num - 1) * 2))

	def sumOfTheSeries(self, n):
		s = 0
		for i in range(1, n + 1):
			s = s + self.dosum(i)
		return s


class Solution:

	def sumOfTheSeries(self, n):
		Sum = 0
		return int(n * (n + 1) / 2 * (2 * n + 1) / 3)


class Solution:

	def sumOfTheSeries(self, n):
		lv = 2 * n - 1
		a = []
		s = 0
		for i in range(1, lv + 1):
			if i % 2 != 0:
				a.append(i)
				s += sum(a[:i])
		return s


class Solution:

	def sumOfTheSeries(self, n):
		s = 0
		a = 1
		while a <= n:
			s += a ** 2
			a += 1
		return int(s)


class Solution:

	def sumOfTheSeries(self, n):
		sum = 0
		for x in range(1, n + 1):
			sum = sum + x * x
		return sum


class Solution:

	def sumOfTheSeries(self, n):
		i = 1
		i2 = 1
		output = 0
		while i < n * 2:
			output = output + (2 * n - i) * i2
			i = i + 2
			i2 = i2 + 1
		return output


class Solution:

	def sumOfTheSeries(self, n):
		ans = 0
		j = 1
		su = 0
		for i in range(1, n + 1):
			su += j
			j += 2
			ans += su
		return ans