# Questions tagged [binary]

For questions about representing numbers in base 2 or performing arithmetic on them.

89 questions
Filter by
Sorted by
Tagged with
20 views

### How can I tell if a bit pattern can represent offset gray-code?

I have a very poor understanding of gray code in general and I find it to be a difficult thing to learn. While trying to learn about it I stumbled upon this seemingly looking trivial question that I ...
12 views

### Consider 4 positive integers a,b,c,d having exactly 10^11 bits (considering the leading zeroes) in the binary representations

Consider 4 positive integers a,b,c,d having exactly 10^11 bits (considering the leading zeroes) in the binary representations. Positions are numbered from 1 to 10^11. Every 3rd bit of a is equal to 1 ...
60 views

### Greedy algorithm for subset sum on powers of 2

I have some $n$ numbers which are powers of $2$, say $a_1,a_2,a_3,\ldots,a_n$ which are not necessarily all distinct. I have option to give them any sign. I have to find if I can make their sum after ...
31 views

### is duality principle in boolean algebra is true for every expression

Let say A = 1 and B = 1 and then A+B = 1 now by using duality(replacing or gate by and gate and 1 by 0) we can say that, A.B = 0 but this is not 0, because 1.1 = 1, so please anyone clear my ...
37 views

### How did we go from Binary to something like Python?

If there's one thing the pandemic has shown us its that High school Geometry did not save us. I am a high school math teacher and I understand my job and its usefulness only exist in a post scarcity ...
41 views

### Simple question about signed integer multiplication

If you have a signed integer int x = any And then state that x < 0 Is the following statement true or false? ...
28 views

### Probability of loss using a binary symmetric channel

Today we talked about Information Theory and the binary symetric channel. For newbies here is a little explanation : For instance if I want to send a binary to someone : The bit will be "flipped&...
54 views

### Converting Decimal Numbers between 0 and 1 to Binary

I've been playing around with a program I wrote that converts decimal numbers to binary numbers and i've noticed that eventually, after applying the algorithm (multiply by 2, subtract 1 if greater ...
49 views

### Is a file a string of zeros and ones?

Is a computer file just a string of zeroes and ones? If so, can it start with zeroes? I have not been able to find an answer, surprisingly.
18 views

### Conversion of fractional part of a hexadecimal number to binary

The Number is given as : (C012.25)Hexadecimal I have to convert it into octal . So I converted it into Binary First and got the result as : 1100000000010010.01000000 (Since each bit in hexadecimal ...
23 views

### 2d cellular automata Wolfram binary codes

This is a similar question to How 2d cellular automata rules works? However, the answer there did not provide me what I am looking for. Specifically, I want to be able to render these 2d cellular ...
42 views

### Is $x$ in the working range [3,2]?

Consider $x$ = $(0.1001)_b$ and $F$[3,2]. ($F$[3,2] is the set of all floating point numbers with 3 digits in the mantissa and 2 digits in the exponent.) The question is $x$ in the working range [3,2]?...
44 views

### How does computer memory store the file name?

I have this doubt for long time. When i save a notepad file, it takes the memory for the information in the file. let's say, I type 'ABC' in notepad and saved the filename as stack, it shows that the ...
40 views

### How does malware enter the computer and take control on a binary or machine code level?

Malware can enter a computer in various ways, but I would like to know how it is able to simply use 0's and 1's and machine code to take over a computer and how it can stay hidden from antivirus ...
90 views

### Binary subtraction with numbers in 2's complement

How can i perform binary subtraction of two numbers that are already in 2's complement? I have to subtract 01010011 from 10100110,both numbers are in 2's complement. I know that 10100110 is -90,and ...
40 views

### Does a megabyte represent (2^8)^1000000 bits in base2? Isn't that more than enough combinations to represent everything?

Every introductory CompSci resource I can find goes through how 8 bits are in a byte, etc. So a byte can store some 2^8 values in binary. Then when asking about four bytes, we can assume this is (2^8)^...
30 views

I have $m$ equations of the following form: $$x_1+x_2+\cdots+x_n=s,$$ where each variable is either 1 or 0, and the total number of variables is $m\approx3{,}000$. So I’m thinking of modeling each ...
43 views

### XOR of three integers where each pair's XOR is the other integer

I have three positive integers, a, b, and c. I know that $a\oplus b\oplus c=0$, so I got that each pairwise xor has to be the other positive integer. $a\oplus b=c$, $b\oplus c=a$, and so on, but I can'...
26 views

86 views

### Calculating direct sum of 2 binary numbers

If we have say,key=‘0110‘ and 𝑚=‘1100‘, how will 𝑚⊕key mod 2 be calculated and what will be the answer equal to?
57 views

### What needs led to the implementation of ASCII codes?

Prior to ASCII existing, we already had at least four number systems, namely Binary Decimal Octal Hexadecimal So what were the needs that lead to the ...
78 views

### Number of nodes of given height in binary heap

Show that there are at most $\lceil n/2^{h+1}\rceil$ nodes of height $h$ in any $n$-element binary heap. How can I show this? Or, how can I prove this?
111 views

### Name of binary encoding scheme for integer numbers

I once found on Wikipedia a nice technique for encoding $k \in (2^{n-1}, 2^n)$ uniformly distributed integer numbers with less then $\log_2n$ average bits/symbol, thanks to a simple to compute ...
581 views

### Why the 127 encodings of ASCII needed to be extended to 256?

As you all know the ASCII chart needed to be extended from 127 encoding to 256, I can't really see why. Some google expert on Coursera said "We needed that because of the foreign languages". I still ...
193 views

### What are some uses of the Thue-Morse sequence in computer science?

Note: I come from a mathematics background. The Thue-Morse sequence $t_n$ is a binary sequence that takes the value $0$ at the positive integer $n$ if the number of $1$s in its binary expansion is ...
33 views

### relationship between binary numbers and binomial heaps

I understand that a binomial heap can be represented as binary numbers according to the degree of each tree but what exactly is the relationship between inserting a new node into the binomial heap and ...
38 views

### Given a binary tree $t$, prove that $size(t) < 2^{h(t)}$

I was able to prove that $size(t) \leq 2^{h(t)} - 1$ for any binary tree $t$, however I wasn't able to do anything reasonable with this statement. I know it's a proof by induction and that the ...
86 views

### How much time (in hours) will it take to check if the number with 20 binary digits is the prime number?

How much time (in hours) will it take to check if the number with 20 binary digits is the prime number, in problem it's mentioned that for number with 10 digits it took 1 hour it's also said that the ...
251 views

### Converting IPV4 address into Binary

So given an IP address it is converted into binary via calculating the binary of all different segments and then joining them. For example, 12.32.18.01 converted into a binary it would amount to this ...
57 views

### Convert scientific notation decimal number to binary

I'm given the number: $$8.881784197001252 \cdot 10^{-16}$$ I know it is $2^{-50}$ but suppose I didn't know. I need to convert it to binary. One way is to apply the school taught algorithm on the ...
959 views

### Minimum number of bits to represent negative number

Minimum number of bits required to represent $(+32)_{base10}$ and $(-32)_{base10}$ in signed two's compliment form? My attempt: 32 = 0100000 ( 1st zero - sign bit as positive) So to represent +32 we ...
39 views

### Fundamental motivation behind the use of bits and binary representation

This is a naive question, but what makes binary representation special from a theoretical standpoint and from the standpoint of information theory? If for technical reasons building ternary computers ...
118 views

### How to convert 010111 to decimal using only odd numbered positions while still applying the correct positional exponent?

I am trying to understand what this question is asking in terms of conversion. I know how to convert binary to decimal and vice versa, but the method you need to use has me confused. I need to ...
29 views

### What's the least signifcant bit of a mantissa system?

If Mantissa is a 1-dot-M fixed-point number whose most significant bit is always 1 then, how is the least significant bit calculated? I know the least and most significant bit of the mantissa ...
275 views

### checking '<' for two binary numbers in a cnf-formula

I want to check whether a arbitrary binary number is less or equal to another binary number in a cnf-formula. I can already construct a formula, which is not in cnf: Lets say n and m are two-digit ...
100 views

### Binary to Decimal Algorithm Explanation

I came across some code today for converting binary to decimal, and I realised that I don't fully understand how it works. Here it is in Python: ...
26 views

### Why does going from 2's complement (in binary) to the positive value by completing to 1 then adding 1 work?

I'm studying Computer science and this has confused me for a long time since our professor didn't give any proof. When changing from 2's complement to the positive value, we can go in reverse (by ...
138 views

### Is decimal number 8 represented as 3 bits or 4 bits in computer?

I was told by my professor that "It takes c * ln(n) bits to store a number n, where ln() is base 2 and c is a constant." Thus, to store a number 8, we need ln(8) = 3 bits(I think const c can be ...
34 views

### Conversion from octal numerical system to binary numerical system

I know that in order to convert a numeral in base-8 to a numeral in base-2 I can write each octal digit as a binary word of 3 bits. I know that 2^3 = 8 that is exactly the dimension of the base of ...
54 views

### Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa [closed]

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa in floating point notation or otherwise. We actually have to prove this is not possible. But why can't we if we have infinite ...
428 views

### Binary representation of 129 when using 8bits for two's complement?

I have this confusion regarding binary representation of decimal value 129 (or even 128). If 8 bits are used to represent numbers when doing the two's complement, then we know that '00000000' to '...
24 views

### For signed integers, why don't representative the smallest number as all zeros in binary, and the largest as all ones?

I'm reading up on bitwise operators, complements, and two's complements, and I'm wondering why the lower limit of a range (aka lowest negative number) isn't all zeroes in binary, and the upper limit ...
663 views

### How do the bits of a certain emoji code for all the colors?

I am watching an introductory course on computer science. At one part, it starts talking about unicode and how the bits 11111011000000010. He states that that codes for a laughing/crying face emoji. ...
118 views

### Is is possible to determine if a given number is xor combination of some numbers?

I have been given a number Y which is ($a$ xor $b$ xor $c$ xor $d$ xor $e$ ) of some numbers ($a$,$b$,$c$,$d$,$e$) and another no X. Now i have to determine if X is a xor combination of ($a$,$b$,$c$,\$...
21 views

### What are the sufficient conditions for weighted binary code to be self compliementary?

I was going through binary codes and found out that if the weighted binary code is self complimentary then it's weights addition will be equal to 9. Is the converse true? If not then what are the ...