All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Bases (Posted on 2024-06-10) Difficulty: 3 of 5
I have a program on my computer that can convert a number from any base to any other base. I started with some number, converted it to another base, and the result was one digit shorter. Then I tried a different base, and the result was again one digit shorter.

Altogether I did this 10 times, and the number grew one digit shorter each time, so the final number was 10 digits shorter than the starting number. (The final number had more than 1 digit.)

What is the smallest number I could have started with?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Probably not the smallest, but ... Comment 1 of 1
I found an answer, but I do not believe it is necessarily the smallest; found somewhat by trial and error.
Decimal 10077696,
in bases [3175, 216, 57, 26, 15, 11, 8, 7, 6, 5, 4]
has number of digits 2 through 12 respectively.

Here is my function for finding the number of digits of a given base 10 number in some other base.
-----
def ndigits(integer, base):
    """ integer is in base 10, returns number of digits in base base """
    import math
    if math.log(integer,base) % 1 == 0:
        return int(math.log(integer,base)) + 1
    else:
        return math.ceil(math.log(integer,base))

----------
for b in [3175, 216, 57, 26, 15, 11, 8, 7, 6, 5, 4]:
    print(ndigits(10077696, b))

OUTPUT:
2
3
4
5
6
7
8
9
10
11
12

  Posted by Larry on 2024-06-11 15:29:29
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information