0.4 Zeeshan’s Bit Manipulation
Zeeshan, a budding programmer with a penchant for puzzles, found himself immersed in a curious challenge. The task was to determine the sum of consecutive natural numbers, starting from 1, up to a specific count. This count was peculiar, being equivalent to the total number of distinct binary strings of length 'n'. For instance, if 'n' were 3, the possible bit strings (000, 001, ..., 111), and the desired sum would encompass numbers from 1 to the number of distinct Binary String length.
Constraints
Input Format
The first line contains a single integer n — Binary String Length
Output Format
An Integer representing the Sum of numbers of the distinct binary string length
Example 1
Input:
3
Output:
36
Explanation:
The Possible Binary Numbers with length 3 are : (000,001,010 …… 111). The count of binary Numbers are 8 and the Sum of Natural Numbers till 8 is 36.
Log In to solve the Question