Ankit and Numbers
Practice
4.1 (16 votes)
Basic programming
Open
Approved
Easy
Mathamatics
Problem
92% Success 11549 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Ankit has a set of numbers and has recently studied set theory. He has created a power set of this set and is writing a program to compute sum of all elements of all the subsets in power set.
Power set of a set S is defined as set of all possible subsets of S.

Set S consist of all the number from 1 to N.

You need to calculate this sum for a given n.

Example:

Given N=3,
S={1,2,3}
P(S) = {{1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}
answer = (1)+(2)+(3)+(1+2)+(1+3)+(2+3)+(1+2+3)
= 24

Input
First line has T, the total number of test cases.
The next T lines contains a number N in each line.

Output
T lines giving answer as defined in the question for each N.

Constraints
1<=T<=42
1<=N<=42

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
1 votes
Tags:
EasySimple-math
Points:20
11 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Points:20
22 votes
Tags:
EasySimple-math