Back to Topic List
Hello all!
Four new problems have been uploaded - the first three deal with expressing numbers in other bases, namely in Binary, in Hexadecimal, and also in any Arbitrary Base.
These three problems are intended as prerequesites to the fourth problem which introduces Kaprekar's Constant.
Hi Kevin!
In the expected result there is minor error: After the first set of numbers (decimal to binary conversion) a space character is missing. So the first result number of the second part (binary to decimal conversion) is "glued" to the end of the last result number of the first set.
The problem is the same with #34 - Hexadecimal Numbers
Hi Kevin,
I found another difference between my results and the expected answers in the "Kaprekars Constant" problem. E.g.:
110 4 | 3 0 | 4 132
322 10 | 3 0 | 7 495
I have checked my code step by step and it seems my values are correct. Do I understand something not correctly?
Thanks!
Hi Adam!
I should have been a bit more clear in the prompt...
When the algorithm is performed on an n-digit number and the result is less than
n digits, then the leading zeroes should be preserved in order to maintain an n-
digit number.
For example in Base-10, instead of 322 -> 99 -> 0, it should be
322 -> 099 -> 891 -> 792 -> 963 -> 594 -> 495
Otherwise I think your logic looks correct for how the problem was originally stated! I updated with a note about the leading zeroes so now the prompt should also be correct :)
Ok, thank you Kevin, I suspected that maybe leading zeros is the problem with mine :) Thanks for clarification.