By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,366 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,366 IT Pros & Developers. It's quick & easy.

This problem may take some time...and programming.

Hunderpanzer
P: 60
I was just looking around on this site, and went into the Jobs category.

I clicked on an interesting job advertisement for BitTorrent - I'm sure we all know what that is, and as a test, the employer wanted someone to give the answer to a problem which would prove their understanding of their math (maybe not so much) and python programming skills.

Don't worry, I'm not looking to steal the answer and take the job. I know nothing of Python, but perhaps it can be done in another language ?

Here it is. Let's see some results, and maybe some code used ?



What is the exponent of the largest power of two whose base seven representation doesn't contain three zeros in a row?

Good Luck!
Jul 23 '07 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Since the job is over 2 months old, it's probably not still available anyway.
Jul 23 '07 #2

Hunderpanzer
P: 60
Since the job is over 2 months old, it's probably not still available anyway.
True, but I've seen some pretty interesting math puzzles in this area of the forum, so I thought it would be cool to share it.
Jul 23 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
True, but I've seen some pretty interesting math puzzles in this area of the forum, so I thought it would be cool to share it.
True, we do have some maths geniuses around.
Jul 23 '07 #4

Banfa
Expert Mod 5K+
P: 8,962
What is the exponent of the largest power of two whose base seven representation doesn't contain three zeros in a row?
Not as easy as it sounds, Python probably unqiuely suited to this problem, this is because most programming languages have a mimited set of integer types, for instance C/C++ typically has

8 bit integers
16 bit integers
32 bit integers
64 bit integers

If you need anything else this needs to be programmed around. This is true for most languages, they have a set of limited integers, however Python has 2 types of integer

32 bit
any size you want

The second type clearly gives a very large problem domain, if you look at the base 7 representations of the first 31 powers of 2 (numbers fitting into a signed 32 bit int) none of them have 3 consecutive zeros.

The first question has to be

Are there any powers of 2 which have 3 consecutive 0s in their base 7 representation?
Assuming the answer to that is yes the question then makes an assumption:
At some value N the base severn representation of 2 ** x for all x >= N contains at least 3 consecutive 0s.
This statement is not self evidently true to me however assuming that it is true then you need to find the minimum value of N and then the answer will be N-1.

Personally I would say thorum solving like this involves mainly maths with little need for programming. In fact I think it would be very hard to write a program to some this to be true, you need to some something to be true for all x >= N not something a computer is very good at doing. Computers are good at doing something for all MIN_LIMIT <= x <= MAX_LIMIT but for this problem there is no max limit, a mathematical proof is required.
Jul 23 '07 #5

Hunderpanzer
P: 60
Not as easy as it sounds, Python probably unqiuely suited to this problem, this is because most programming languages have a mimited set of integer types, for instance C/C++ typically has

8 bit integers
16 bit integers
32 bit integers
64 bit integers

If you need anything else this needs to be programmed around. This is true for most languages, they have a set of limited integers, however Python has 2 types of integer

32 bit
any size you want

The second type clearly gives a very large problem domain, if you look at the base 7 representations of the first 31 powers of 2 (numbers fitting into a signed 32 bit int) none of them have 3 consecutive zeros.

The first question has to be

Are there any powers of 2 which have 3 consecutive 0s in their base 7 representation?
Assuming the answer to that is yes the question then makes an assumption:
At some value N the base severn representation of 2 ** x for all x >= N contains at least 3 consecutive 0s.
This statement is not self evidently true to me however assuming that it is true then you need to find the minimum value of N and then the answer will be N-1.

Personally I would say thorum solving like this involves mainly maths with little need for programming. In fact I think it would be very hard to write a program to some this to be true, you need to some something to be true for all x >= N not something a computer is very good at doing. Computers are good at doing something for all MIN_LIMIT <= x <= MAX_LIMIT but for this problem there is no max limit, a mathematical proof is required.
I see. Maybe it's not such a great puzzle then.

I'll keep an eye out for others.
Jul 23 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.