Number Groups

3.5

2 votes
Easy
Problem

The positive odd numbers are sorted in ascending order, and grouped as (1),(3,5),(7,9,11)... and so on.

Thus, the first group is (1), the second group is (3,5), etc. In general, the kth group contains the next k elements 
of the sequence.

Given k, find the sum of the elements of the kth group.

Input Format:
An integer k.

Constraints
1<=k<=10^6

Output
Sum of kth group.

Sample input:
3

Sample output:
27
 

Time Limit: 0.5
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?