Disclaimer: May contain made up information about kangaroos.
Kangaroos traverse several stages of development. As they grow older and stronger, they can jump higher and longer, and they can jump more times before they get hungry.
In stage 1, the kangaroo is very little and cannot jump at all. Despite this, is constantly requires nourishment. We can represent a stage 1 kangaroo's activity pattern like this.
In stage 2, the kangaroo can make small jumps, but not more than 2 before it gets hungry. We can represent a stage 2 kangaroo's activity pattern like this.
o o o o o
After stage 2 the kangaroo improves quickly. In each subsequent stage, the kangaroo can jump a bit higher (1 unit in the graphical representation) and twice as many times. For example, a stage 3 kangaroo's activity pattern looks like this.
o o o o o o o o o o o o o o o o o
All that jumping requires energy, so the kangaroo requires nourishment after completing each activity pattern. The exact amount required can be calculated as follows.
Assign each o in the activity pattern of a stage n kangaroo its height, i.e., a number from 1 to n, where 1 corresponds to the ground and n to the highest position.
Compute the sum of all heights in the activity pattern.
For example, a stage 3 kangaroo's activity pattern includes the following heights.
3 3 3 3 2 2 2 2 2 2 2 2 1 1 1 1 1
We have five 1's, eight 2's, and four 3's; the sum is 5·1 + 8·2 + 4·3 = 33.
Write a full program or a function that takes a positive integer n as input and prints or returns the nutritional requirements per activity of a stage n kangaroo.
This is code-golf; may the shortest answer in bytes win!
1 -> 1 2 -> 7 3 -> 33 4 -> 121 5 -> 385 6 -> 1121 7 -> 3073 8 -> 8065 9 -> 20481 10 -> 50689