Skip to main content

Questions tagged [binary]

For challenges about binary, or the base 2 number system.

4 votes
4 answers
582 views

Your task is to find a boolean expression that uses AND (\$\land\$), OR (\$\lor\$), XOR (\$\oplus\$), and NOT (\$\lnot\$) operators and binary digit positions (\$d_1,d_2,d_3,d_4,d_5,d_6,d_7,d_8,d_9,d_{...
Fmbalbuena's user avatar
  • 5,085
-2 votes
5 answers
332 views

The task is to find the shortest solution to the following problem: Given an integer \$n\$ (\$0<n<10^7\$) find \$n+C(n)\$, where \$C(n)\$ is the count of set bits in the binary representation of ...
Lev's user avatar
  • 11
5 votes
9 answers
362 views

Given a binary string \$s\$ of length \$2^n\$ and a permutation \$\sigma\$ of \$\{1,\dots,n\}\$, generate the binary string \$u\$ of length \$2^n\$ which is a reordering of \$s\$ such that \$u[i^\...
Karl's user avatar
  • 871
23 votes
11 answers
2k views

(easy mode of Seven Slash Display) Given a positive integer (or alternatively, a string/list of bits of its binary representation) output it with this diagonal ASCII-art formation: (output for 53 / <...
noodle person's user avatar
9 votes
7 answers
1k views

The Horrible Histories song "Learn Your Hieroglyphics" mentions a fanmade number system. Numbers are written as a sum of 10's ("hoops") and 1's ("eyes"), for example 99 ...
3-1-4-One-Five's user avatar
13 votes
27 answers
1k views

Task is simple! Take an array of binary values (can be boolean, 0/1, etc.) and use those bits to construct an n-th bit long unsigned integer (return type does not need to be an unsigned integer, just ...
ThePlaneGuy45's user avatar
14 votes
14 answers
3k views

Objective Given an integer \$n\$ interpreted as two's complement binary, output two integers, namely the integer consisting of \$n\$'s bits at places of \$2^0, 2^2, 2^4, \cdots\$, and the integer ...
Dannyu NDos's user avatar
  • 7,371
6 votes
2 answers
425 views

Background Often, when storing a number in binary with some maximum, we simply round the maximum to the next power of two then allocate the number of bits nececairy to store the whole range. Lets call ...
mousetail's user avatar
  • 14.4k
10 votes
6 answers
854 views

This is an exact inverse of the question Convert to Spoken Binary. This introduction is copied from there. Introduction In the video the best way to count, binary is proposed as the best system of ...
Tbw's user avatar
  • 3,033
16 votes
6 answers
1k views

Introduction In the video the best way to count, binary is proposed as the best system of counting numbers. Along with this argument is a proposal on how to say numbers in this system. First, we give ...
Tbw's user avatar
  • 3,033
18 votes
39 answers
3k views

The Rudin-Shapiro sequence is a sequence of \$1\$s and \$-1\$s defined as follows: \$r_n = (-1)^{u_n}\$, where \$u_n\$ is the number of occurrences of (possibly overlapping) \$11\$ in the binary ...
alephalpha's user avatar
  • 51.9k
2 votes
2 answers
279 views

Not sure if it's correct to ask such a question on this site, but let's try. Let a(n) be a sequence of positive integer such that a(1) = 1. To reproduce the sequence a(n) through itself, use the ...
user avatar
20 votes
23 answers
3k views

Challenge: Given a positive number \$n\$, convert it to binary, and output a sequence where all 1s form a top-left to bottom-right diagonal line, including a ...
Kevin Cruijssen's user avatar
17 votes
5 answers
882 views

In this challenge, we consider an encoding from positive integers (up to a limit) to binary sequences. Some examples: ...
Bubbler's user avatar
  • 79.3k
15 votes
44 answers
4k views

The title says it all; Given a number in the binary (base-2) number system, output the same number expressed in unary (base-1). You should take the binary number as a string (optionally with a ...
noodle person's user avatar

15 30 50 per page
1
2 3 4 5
17