6 kyu
Imaginary Base Conversion
107 of 246feeg1
Description:
You have been tasked with converting a number from base i (sqrt of -1) to base 10.
Recall how bases are defined:
abcdef = a * 10^5 + b * 10^4 + c * 10^3 + d * 10^2 + e * 10^1 + f * 10^0
Base i follows then like this:
... i^4 + i^3 + i^2 + i^1 + i^0
The only numbers in any place will be 1 or 0 Examples: 101 in base i would be:
1 * i^2 + 0 * i^1 + 1*i^0 = -1 + 0 + 1 = 0
10010 in base i would be:
1*i^4 + 0 * i^3 + 0 * i^2 + 1 * i^1 + 0 * i^0 = 1 + i = 1+i
You must take some number, n, in base i and convert it into a number in base 10, in the format of a 2x1 vector.
[a,b] = a+b*i
The number will always be some combination of 0 and 1
In Python you will be given an integer. In Javascript and C++ you will be given a string
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Nov 27, 2016 |
Published | Nov 27, 2016 |
Warriors Trained | 800 |
Total Skips | 158 |
Total Code Submissions | 654 |
Total Times Completed | 246 |
Python Completions | 107 |
JavaScript Completions | 45 |
C++ Completions | 109 |
Factor Completions | 6 |
Total Stars | 15 |
% of votes with a positive feedback rating | 90% of 73 |
Total "Very Satisfied" Votes | 61 |
Total "Somewhat Satisfied" Votes | 10 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 13 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |