iliana :trans_heart: is a user on cybre.space. You can follow them or interact with them if you have an account anywhere in the fediverse.

uhhhh hmm

let’s say I want to store the ASCII integer representations of values 0..15 inclusive in memory

if I allow the memory to overlap I can represent it as

151413121109876

thus 15 and 5 overlap, 11 and 10 overlap

this *might* be the shortest possible representation

is there already a known algorithm for this? is this problem called something?

iliana :trans_heart: @iliana

I’ve decided I’m going to brute force it since I specifically need 0..255 inclusive lol

@iliana seems to me for that case it's pretty straightforward:

3 digit numbers: no overlap, all appear as is
2 digit numbers: all appear as subsets of the 100s
1 digit numbers: all appear as subsets of any group of 10s, so just reuse some random one (24x for example)

@iliana might not be optimal but i can't think of anything terribly clever to make it better (125200 for example could get you 252 for free...but you can only do that for 120-125 so it only saves you like 20 characters overall)

@chr @iliana i feel like it'd be pretty easy to optimize for the 210s just from 1X21X3 right??

@chr @iliana Even with a range of integers (0..255) this problem is a lot more complicated than I thought.

For instance: 1222121112. Every three-digit substring is a unique number in the range! That's as dense as you can get.