last day (15 days later) » 

9:05 AM
0
Q: The smallest number to represent a set of numbers

Pradyoth ShandilyaI would like an "algorithm" to find the smallest number that can represent a list of numbers exactly, order included. As an example, if a list is [2 3 4 6 9], I would like an algorithm to yield a number X such that X contains the information and order of each number in the list so that I can "r...

 
you want an hash
 
a hash (at least in the computer-science sense) is not reversible right?
 
do you have conditions on the list? such as, max length, max number that may appear, etc.?
 
I would be very happy if the range of numbers is the set of whole numbers less than 10. As for the list, the length is not predetermined and can vary to any finite extent.
 
less than 10? so.. digits? In that case just concatenate them
 
9:05 AM
Correct. All the values are digits
 
Just concatenate them
 
That did occur to me. But is that the smallest possible number? Also, when operating with different base representation of numbers (such as hex) or if I decide to change the max number to say, 16, it will not work. This is why I did not explicitly mention "digits" in the question.
 
Does your list contain repeated numbers? Are they always monotonically sorted?
 
Yes, repeated numbers are possible. No, the list is not monotonically sorted in general.
 
Hi
 
9:05 AM
Hello
 
A note: if the numbers are not sorted
then your algorithm do not work
since, for example, the lists [1,2] and [2,1] are both represented by the same number
 
"As there are 5 numbers in the list, let us consider five other numbers a,b,c,d and e. We replace 'a' with the first number in the list. We replace 'b' with the sum of the first two numbers. Replace 'c' with the sum of the first three numbers and so on."
This part of the algorithm ends up sorting the numbers in an ascending order
Assuming all the values are positive
 
but then you do not know the original sorting of the numbers
try to compute it for [1,2] and [2,1]
 
okay
[1,2] becomes [1,3] on applying the above mentioned step
[2,1] becomes [2,3] with the same step
from [1,3], I can get [1,2] again
 
oh, I did not read "sum"
 
9:09 AM
ah okay
 
ok, then, if you work just with digits, your method and mine are more or less the same
in the sense that they are "optimal"
 
actually, isn't my method "worse" in case of large sets?
 
depends on how you measure "how bad" it can go
 
hang on. calculating the result for the list [1,2,3,4,5]
well
using your approach
I get 12345 as the result
which is pretty obious
with my approach
i get 177190
which is a lot larger
 
yes, but try it with [1,0,0,0,0]
 
9:15 AM
true
 
with my approach it is 10000
with yours it is 32
 
fair enough
 
in this case you have to specify how to measure "how bad" it goes
 
ah
and this is done using a tool like?
I have vaguely read about complexity
in cs
 
It depends on what you want to optimize. It is not theory, but practice
 
9:17 AM
is this that applicable here?
I am trying to develop a compression algorithm here
 
For example "I want to minimize the maximum number I obtain from any ilst of length at most N"
 
so if you have a second, I could describe my idea
are you going to stick around for a minute or so?
 
go on
 
imagine an image represented by an array of integers
 
hmhm
 
9:19 AM
now using some "algorithm", let's say I convert this image into a single number
say between 0 and 15
a very large number
 
k
 
Now my idea is to represent this number by the closest perfect power below it
which can be very easily represented
 
in term of "compression", yes
 
a number as large as a billion can be represented by 10^9
right
now i count up from the value of the perfect power
and get back an original list for every number
using some sort of a machine learning algorithm
i can find out if the image makes sense at all
because most of the "images" i obtain from this are bullshit
so once I reach the actual number I had
I will know it is the right one
because in some way, "it makes sense"
it is very vague indeed
 
"now i count up from the value of the perfect power
and get back an original list for every number"
you actually lost me there
 
9:23 AM
okay, hang on
 
in the sense, for example, that I submit 10^9 to a neural network and hope it rounds off to the nearest "sensible" image?
 
now let's say the list generated the large number with value "1000467000"
yep, kinda
it checks if an image is there for every number between a billion and a billion plus 467000
assuming a billion is the closes perfect power below the "large number" I have
 
I'm not sure how can you find a "nearest perfect power" from a random huge number
but I get that it is not the problem you're asking here
 
well, at the moment, neither do I. But if we have an ultra powerful computer, we could just count down from the huge number till we find a perfect power
right
 
actually, it may be the problem you should be asking
because, you do not want a generic "low" number representing your image
but a number that is close to a perfect power, that, in turn, has also a low base and a low exponent
and now I'm just wondering if you could just write it in exponentail form
Like, instead of compressing the image into a perfect power, you do a different thing
for example, take 1432981937932909317493849031493843840342398432943184
and compress it into the first $log(log(n))$ digits and the number of digits
 
9:35 AM
ah
yeah, that is a good idea
thanks. I'll see what I can do with this
 
bye
 

last day (15 days later) »