[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [puzzle] coding



Hi Van,


>
>Suppose you have a finite sequence of  natural number (integers >0) and
>want to send it to a friend 
>using one digit 1 only (meaning what you  send and what your friend gets
>is a sequence of 1's). How can you encode  it so that 
>your friend is able to read your original sequence ? 
>
> 



Very good puzzle, my solution is below:

Goal: {N1, N2,...Ni,...Nk} -> 1111....11111

Steps:
   1. Ni -> Mi = 1111...111 (Ni digits)
   2. Concat Mi to M, using 0 digits as hyphen character:
      M = <M1><0><M2><0>...<0><Mi><0>....<0><Mk>	 
   3. M -> 1111...1111 ( M digits)
	
  
E.g.

1, 2, 3, 0, 4 -> ?
------
 1. step: 1 -> 1;  2 ->11, 3-> 111, 4 -> 1111, 0 ->
 2. step: M = 10110111001111
 3. step: M -> 11111....11111  (10110111001111 digits) 

So, 

1,2,3,0,4 -> 11111....11111  (10110111001111 digits) 

BR,
Son,


>