← Back to challenges

Little Big Sequence

JavaScriptHardmathnumbersloops

Instructions

A number sequence is as follows:

5, 100, 6, 200, 7, 400, 8, 800, 9, 1600, 10, 3200, ...

Given that 5 is at position 1, create a function that returns the number found at position num in the sequence.

Examples

littleBig(4) ➞ 200

littleBig(5) ➞ 7

littleBig(28) ➞ 819200

Notes

You can expect to be only given valid inputs.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Smallest N Digit Number