Skip to main content

Questions tagged [binary]

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

23 votes
11 answers
2k views

Binary Slashes Display

(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
6 votes
4 answers
1k views

Hoop, Hoop, Hoop, Hoop, Eye-Eye-Eye-Eye

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
11 votes
23 answers
922 views

Construct a uInt from an array of bits

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
2k views

Break an integer into even- and odd-indexed bits

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
  • 5,961
6 votes
2 answers
356 views

Compact Binary Representation

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
  • 12.7k
10 votes
6 answers
745 views

Convert from Spoken Binary

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
  • 2,093
16 votes
6 answers
1k views

Convert to Spoken Binary

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
  • 2,093
18 votes
39 answers
2k views

Rudin-Shapiro sequence

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
  • 48.7k
2 votes
2 answers
243 views

Binary expansion and partition numbers [closed]

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 ...
Notamathematician's user avatar
20 votes
23 answers
2k views

Diagonal Binary Sequence

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
16 votes
5 answers
726 views

Prefix code generator

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

Convert binary to unary

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
1 vote
1 answer
174 views

Start a program so that /proc/self/cmdline contains a binary representation of the input number

I am sorry for the very long description. But i think some information of how /proc/self/cmdline works and how it can be used to get a integer input was necessary. ...
12431234123412341234123's user avatar
1 vote
0 answers
171 views

making a binary string palindrome using xor operations [closed]

Problem You are given a binary string A of length N. You can perform the following type of operation on the string A: Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$) Change \$...
hemanth's user avatar
  • 11
21 votes
13 answers
2k views

Minkowski's ?(x) for rational x

Here is Minkowski's question mark function: It is a strictly increasing and continuous function from the reals to themselves that, among other unusual properties, maps rational numbers to dyadic ...
Parcly Taxel's user avatar
  • 3,845

15 30 50 per page
1
2 3 4 5
16