r/counting • u/cojoco 0x2g • Mar 29 '17
[New] "Minimum bits" encoding, 20 bits
This is a style of counting for situations in which encoding a 1 is a lot more expensive than encoding a zero. n binary bits encode 2n distinct numbers, but the numbers are ordered with 0 bits first, then all numbers with a single '1' bit, then all numbers with two '1' bits, etc.
For example, five "one" bits in a binary number with 65,536 digits can encode 1022 distinct values, or ~72 bits.
For four digits, the codes are:
0000 0001 0010 0100
1000 0011 0101 0110
1001 1010 1100 0111
1011 1101 1110 1111
I haven't seen it named anywhere, so I'd call it "combinational" encoding, because it encodes n C r values for each r going from 0 to n.
It only supports a fixed number of digits, so I picked 20, for about a million comments.
The first few numbers 0, 1, 2, 3:
00000000000000000000
00000000000000000001
00000000000000000010
00000000000000000100
20, 21, 22, 23, 24:
10000000000000000000
00000000000000000011
00000000000000000101
00000000000000000110
00000000000000001001
The first "get" is at 0011 1000 0000 0000 0000 (1026), thanks padiwik.
The next "get" is at 0000 0001 1110 0000 0000 (1026+1039=2065), thanks piyushsharma301.
It is simple to work out the successor to a number:
Working from the right, find the first '01' string
Replace it with '10'
Place all the '1' bits to the right of it as far as possible to the right
If there is no '01' string, then increment the number of '1' bits and place them all at the right-hand side
Examples:
Simple:
010010
010100
Two bits changing:
100110
101001
Increased number of bits:
111000
001111
3
u/Urbul it's all about the love you're sending out Apr 10 '17
Yo /u/padiwik I heard you like math so put down all the math threads from the math thread section in the directory so you can math like a math addict dawg. (Also sniped cojoco)
Mathematical Formulas and Series
abacabadabacaba Pattern
Thread
Asymptotic
Initial Thread
Current Thread: 9.99 (100)
Cube Numbers
Initial Thread
Current Thread: 419 (Revival)
Digital Roots
Thread
e^x
Thread
Expressions
Thread
Factorial
Initial Thread
Current Thread: Revival from 300!
Fibonacci
Initial Thread
Current Thread: Revival from 433
Four Fours
Initial Thread
Current Thread: 1207 (Revived)
Inverses
Initial Thread
Current Thread: Revival of initial thread
Nilakantha Series
Thread
Pascal's Triangle (Lines)
Initial Thread
Current Thread: 36 (37) (668)
Permutations
Initial Thread
Current Thread: 5123467 (~3400)
Pi's Digits
Initial Thread
Current Thread: Part 3
Prime Numbers
Initial Thread
Current Thread: Revival from 41609
Square Numbers
Initial Thread
Current Thread: From 5522
Stern-Brocot Fractions
Thread
Summation of (n)pi
Thread
Triangular Numbers
Initial Thread
Current Thread: Revival from +274
Weird Numbers
Thread