Binary is the base 2 number system. Use this tag for challenges involving base 2.

learn more… | top users | synonyms

15
votes
25answers
1k views

Convert a string of binary characters to the ASCII equivalents

Take a string of binary characters separated by a space, and convert it to an ASCII string. For example... 1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100 ...
4
votes
8answers
433 views

Give me the Gray Code list of bit width n

The Gray Code is a sequence of binary numbers of bitwidth n where successive numbers differ only in one bit (see example output). Reference Example input: 3 Example output: 000 001 011 010 110 ...
0
votes
2answers
517 views

Make a regex that matches certain binary numbers [closed]

Your task is to create a regular expression that matches most binary numbers with an even number of 0s and an odd number of 1s (e.g. "101100011"). The full criteria for the regex are: matches 90% ...
5
votes
2answers
444 views

math with bitwise operators

objective write a program that can perform addition, subtraction, multiplication, and division, using only bit-wise operators, by bit-wise operators i mean the equivalent of JavaScript &, |, ^, ...
-1
votes
5answers
245 views

change two bits by using only bitwise operations [closed]

try to write shortest possible variant of logic which converts binary input by this table: 00 -> 00 01 -> 10 10 -> 01 11 -> 11 You can use only bitwise and bitshift operations. I ...
8
votes
3answers
1k views

Bitwise Operators in Brainfuck

Your task is to create one brainfuck program for each of the following binary operators. Each program should take one or two 8-bit numbers (A and B) from input and calculate the specified operation: ...
6
votes
4answers
508 views

Convert from binary to unary in 7x7 Manufactoria

In the game manufactoria, take in a binary number and output that number of red pieces. The catch? The board-size is only 7x7: Here's the manufactoria code for the problem: ...
3
votes
6answers
481 views

Generating Binary shapes

How could we generate shapes or images using binary? I got to messing around trying to create something that looked matrix like and got to thinking, wouldn't a great CodeGolf be to see who can make ...
5
votes
3answers
642 views

Implementing Binary Arithmetic

Given two binary numbers (strings containing 0s and 1s), perform operations on them, with one problem: You must keep them in binary. That means no going binary(integer(n1)+integer(n2)) or anything ...
11
votes
12answers
1k views

Calculate hamming weight with low hamming weight

Create a program that computes the hamming weight of a string. Winner is the program with the lowest hamming weight. Rules: Hamming weight for an ASCII character is defined as the total number of ...
-3
votes
3answers
305 views

Binary Bit Adder [closed]

Title says it all, make a bit adder in as little space as possible! The input is two binary numbers. Here's my Python entry, at 159 characters: a=raw_input() b=raw_input() d=0;e='' for i in ...
-2
votes
5answers
2k views

compute number of 1 bits in a binary representation of a number

The goal is to write a program that returns number of 1 bits in a given number. examples 5 -> 2 1254 -> 6 56465 -> 8 goal the winner is the code which runs in minimum time ...
5
votes
4answers
530 views

Convert from binary to negabinary

Given a binary integer inclusively between 0 and 1111111111111111 (i.e. a 16-bit unsigned integer) as input, output the same integer in negabinary. The input can be in whatever format is most ...
9
votes
32answers
2k views

Print the amount of ones in a binary number without using bitwise operators

Description Given a number, print the amount of 1s it has in binary representation. Input A number >= 0 in base 10 that won't exceed the highest number your language is able to handle. Output ...
2
votes
11answers
468 views

position of the only 1 in a number in binary format

Given N is a number from this list : 1, 2, 4, 8, 16, .... 2^i as you know there is only a single "1" in binary representation of above numbers. Question : write a code to find out the position of ...
8
votes
6answers
929 views

Manchester encode a data stream

Manchester coding is a telecom protocol used in radio communications that guarantees bit transitions at a regular interval so a receiver can recover the clock rate from the data itself. It doubles the ...
6
votes
2answers
428 views

Floating point addition, without floats!

Your task is to write a program, in any language, that adds two floating point numbers together WITHOUT using any fractional or floating point maths. Integer maths is allowed. Format The format for ...
5
votes
1answer
2k views

Nokia mystery puzzle [closed]

A friend sent me this puzzle. I'm pretty sure solving it will require some programming. Can anyone crack it? The original is here in case of encoding issues in the past below. Did you know that... ...