Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 91213

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

5 votes

CGAC2022 Day 9: Playing with bits

Rust, 52 bytes |j|(1u32..).filter(move|i|(i^i*2).count_ones()==j*2) Attempt This Online! Uses the xor trick. Could save 1 byte by using u8 and abusing the "ignore number limits" rule.
mousetail 'he-him''s user avatar
3 votes

Generate Parity bits

Rust, 120 117 bytes -3 bytes thanks to JSorngard |k:Vec<_>,m|k.iter().copied().chain((0..m).rev().map(|j|k.iter().filter(|i|**i).count()&1<<j>0)).collect::<Vec<_>>(); Attempt This Online!
mousetail 'he-him''s user avatar
6 votes
2 answers
366 views

Compact Binary Representation

by the log2(m)-bit binary representation of x-d-1. … The binary representation can be as a string, integer, list of ints, decimal coded binary, or anything else reasonable. If you prefer you can take m+1 as input instead of m. …
mousetail 'he-him''s user avatar
3 votes

CGAC2022 Day 9: Playing with bits

><> (Fish), 71 bytes i1:0$:2%?\2 ,40. >:?v~{:}= ?^1+10. 01.\:2%?v\$1+$1-2, 1.11,2-1/ /:naob Try Explanation ><> lacks any kind of bitwise operators. So the only way to do this is with modulo. Basic …
mousetail 'he-him''s user avatar
16 votes
7 answers
1k views

Largest Binary Area

1 1 1 11 11 11 11 1111 1111 11111111 11 Notice there are areas of connected 1s in the binary representation of the number. … Your task is, for a given n, calculate the biggest continuous area in the binary representation of all numbers less than n. …
mousetail 'he-him''s user avatar