# Tag Info

15

As ratchet freak says, you have ten decimal digits, which should give $10^{10}$ possible values. But in practice, there are a few more restrictions. The format of a North American telephone number looks something like this: [2-9][0-8]\d - [2-9]\d\d - \d\d\d\d This gives 8*9*10 * 8*10*10 * 10*10*10*10 values. In addition, the fifth and sixth characters can'...

11

You have 10 base10 digits. This is $10^{10}$ possible values. Encoding this in an alphabet with 64 tokens you need $\lceil \log_{64}(10^{10}) \rceil = 6$ characters. If you encode it in straight binary you only need $\lceil \log_{2}(10^{10}) \rceil = 34$ bits total. 4 bytes + 2 bits. Unless there is a pattern in the number itself this is the best you can ...

11

The largest 12 digit number in base 10 is $10^{12} - 1$. In general the largest $n$ position number in a base $b$ is $b^{n} - 1$. So in your case you need a base large enough that $b^{9} - 1 > 999,999,999,999$ $(10^{12} - 1).$ Solving for $b$: $$b^{9} - 1 > 10^{12} - 1$$ $$b^{9} > 10^{12}$$ $$b^{9/9} > 10^{12/9}$$ $$b > 10^{12/9}$$ $$b >... 5 Just converting the comment into a short answer: 7 = \text{int}(\log_{2} 236). Generally, p = \text{int}(\log_{B}V). As other people pointed out, this algorithm is needlessly complicated and not practical; it is not easy to calculate \log_B V for large V by pencil and paper. Instead, use the other algorithm which is also mentioned in the article ... 5 Define f(s)=h(g(s)), where g(\cdot) is the conversion to octal and then interpreting the result as a decimal string, and h(\cdot) is the conversion to hexidecimal and then interpreting the result as a decimal string (if possible). For instance, g(245)=365, and h(365)=163. Asymptotically, it is easy to see that g(x) \sim x^\alpha, where \alpha =... 4 I don't think this is possible. Changing a high-order digit in a base-10 number -- say, changing 5000000 to 6000000 -- can change bits in its binary equivalent all the way from high-order bits to fairly-low-order bits: 10011000100101101000000 10110111000110110000000 It doesn't change the very lowest bits: Since 10 = 5\times 2, the digit in position k ... 3 I am not an expert in this area, but the following is what I know about this problem. This problem was solved in the following paper: William D. Clinger. How to read floating point numbers accurately, ACM SIGPLAN Notices, 25(6) [Proceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation], pages 92–101, June 1990 (A PDF, ... 3 Hint: The respective weights of the hex digits are (in decimal)$$16,1,\frac1{16},\frac1{256},$$hence$$3\cdot 16+12\cdot1+\frac{14}{16}+\frac{8}{256}.2 You can do better than quadratic in the length of the fraction, but doing so requires fast (subquadratic) multiplication algorithms such as Karatsuba or Schönhage-Strassen. First, multiply by a suitably large power of 10 to obtain an integer (note that the exponent of this power is at most linear in the length of the fraction). The problem is now to convert ... 2 You would pick some number a, run the code, and see if you can find a pattern. There will be an obvious pattern. Then you think how you can use that pattern to find long ranges of numbers i where r ends up being 1, and long ranges where r does not end up being 1. When you've done that, all you do is add up the number of values in those ranges of values i ... 2 You're on the right track, it is similar to binary in a way. The first step to coming up with an efficient solution is to recognize that to convert a number from the 3,4 system to decimal, you can treat 3's like a 1 in binary, they have a value equivalent to 2^n where n is the position of the digit, starting from the right n starting at 0. ... 2 Let me start with a short introduction on computation models. A (C-like) computation model specifies the inventory of operations, and the cost of each operation. Two popular computation models are the bit complexity model and the word RAM model, though the latter doesn't really have a canonical description. In the bit complexity model, all basic operations ... 2 You can't do this - if you don't know whether the input is k digits or k+1 digits, then the additional decimal digit changes all or most of the hexadecimal digits. For example 100 -> 64, but 1000 -> 3e8. Also, consider the numbers 16^k-1 and 16^k. In hexadecimal, one is k f's, the other is 1 followed by k zeroes. Since 16^k in decimal doesn't end in ... 2 Its not a coincidence. It is a general result for any number represented in a positive base b, its representation in base b^k for some positive integer k, is simply grouping k digits in its base b representation starting from the least significant digit to the most significant digit. Take base 10 for example. 427428 in base 10 is (4,2,7,4,... 2 Draconis already gave an excellent answer of the specific theoretical limitations of your question. However, I figured it wouldn't hurt to show an explicit implementation of such an encoding schema. As Draconis covered we need an alphabet of at least 90 letters in order to encode a North American based telephone number in 5 characters or less. As luck would ... 1 Since you don't have any questions in your post, it's hard to give any concrete tips. Try to do the simpler binary to unary converter instead. And should also assume that you have as many working tapes as you need (say, one input tape, one counting tape and one work tape) and a separate output tape. You should also pick that of LSB/MSB that suits you best ... 1 Let me demystify b's complement. Let b \geq 2 be an integer. Given a d-digit integer x is base b, we want to find a d-digit integer y such that y \equiv -x \pmod{b^d}. Why is this useful? Suppose that z is also a d-digit integer, and assume that z-x \geq 0. Then z-x \equiv z+y \pmod{b^d}, and so if we add z and y and ignore the ... 1 Partial answer: It works for some pairs b_1 b_2, but may not work for every pair. Partial solution: for pairs b_1 b_2 where there is an x, p_1, p_2 \in \mathbb{Z} such that \begin{alignat*}{4} x^{p_1} & {}={} & b_1\\ x^{p_2} & {}={} & b_2 \end{alignat*} you can divide n of b_1 into sections of p_2  digit sections, ... 1 This answer is not complete, but it is the start of a complete answer, and nothing else has been offered. I hope to finish it another time. I have found that an online right-to-left algorithm exists in a more general case than I mentioned in my original question. I suspect that no such algorithm exists in general, for reasons I outlined in my comment. ... 1 Decimal numbers with k digits to the right of the decimal point are 10^{-k} apart. So if you choose k large enough that 10^{-k} < 2·2^n, then there is a decimal number with k decimals inside the interval. You can for example calculate it as round (x·10^k) / 10^k. You may be lucky, and a number with fewer decimals may be inside the interval. ... 1 20 02 00 00 26 53 53 42 89 b2 e5 c2 71 3d 76 41 Full answer is impossible in your case, instead I'm giving clarifications. We should know the data format to convert binary file to human readable form or do a work similar to breaking a naive cryptographic protection. At layman's terms, we have an ordered set of senseless bytes without a clue. We need ... 1 Every non-negative real number can be represented in any integer base b \geq 2 as a string of the form x_{n-1} \ldots x_0.x_{-1} x_{-2} \ldots, $$where x_i \in \{0,\ldots,b-1\}, and the string is interpreted as having the value$$ x_{n-1} b^{n-1} + \cdots + x_0 b^0 + x_{-1} b^{-1} + x_{-2} b^{-2} + \cdots.  For example, 251.5625 in base 10 is the ...

1

In Cisco academy for doing the math by heart we know the powers of two, to allow us to do calculations by head. Note that the algorithm only is efficient once you can do it on your head, as it is mostly subtractions once you are familiar with the procedure. The algorithm works roughly this way: you pickup the power of two immediately lower to your value ...

1

Hint: Consider $25_{10}$. The number can be written as $5 \cdot 10^0 + 2 \cdot 10^1$. How can $25_{r}$ be written?

Only top voted, non community-wiki answers of a minimum length are eligible