Base Conversion

Challenge: determine the intended value of the following base two number. You will need to find out which base the number was originally in (it should become obvious when you are right)
http://paste.pocoo.org/show/558911/ (pastebinned for convenience)

Hint: java.lang.Character.MAX_RADIX is too low.
1. Determine the number of bits in that huge base two number (just put it in a std::string and get the size of the string).

2. Do a prime factorization of that

3. The number of bits in the the original radix of the number must be one of the factors

For the problem to have a unique answer, the number of bits must be a prime number.
(I am assuming that leading zero bits in the binary representation have not been removed; if they have been, there are an unlimited number of correct answers.)
There were no leading zeros in the first place, it was constructed from a base ten number which was constructed from a number in another base.
Maybe I don't understand the question.

If the intended value is not the value that is expressed by the base two number, there is no way to determine the intended value. Expressing the value via a particular base requires a particular representation, but the value remains the same despite the different representation.

By way of example, the value represented by 10 as a binary number is the same value represented by 2 in base 10. No matter what base you use, it is the same distance from 0.

Seems terribly arbitrary to me. What am I getting wrong?
> it was constructed from a base ten number which was constructed from a number in another base.

So the other base could be anything at all as long as it is greater than one; so any answer that is two or above is a correct answer.
The correct answer is the original number and its base. You will know when you have guessed the correct base, it is a message.
JLBorges wrote:
So the other base could be anything at all as long as it is greater than one
LB wrote:
Hint: java.lang.Character.MAX_RADIX is too low.
java.lang.Character.MAX_RADIX+1?
It's kind of hard to give a message with only numbers 0-9, letters A-Z, and letter a.
So write something like this, and pick up the radix and the output for whatever you fancy forms a 'message'. If you are Claude Shannon, you may pick up any one of them at random; all of them are 'messages'.

#include <iostream>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string>
#include "gmp.h"
#include <cstdio>

int main()
{
    mpz_t number ;
    std::string message = "001110101100110001101100011101011" ; // etc.
    mpz_init_set_str( number, message.c_str(), 2 ) ;

    for( int radix = 3 ; radix < 63 ; ++radix )
    {
        std::cout << "radix " << radix << ": " ;
        mpz_out_str( stdout, radix, number ) ;
        std::cout << "\n\n" ;
    }

    mpz_clear(number) ;
}

Last edited on
It is two words in CamelCase. I would have thought that by 'message' it was clear I meant 'english writing'.
Any string of bits is a message in information theory parlance.
Topic archived. No new replies allowed.