Roger Hui wrote:
> Suppose
>
> c=: ?256
> d=: 16+?16
> e=: a.{~ c (d b.) i.256
> NB. e is used as: map=: e {~ a. i. ]
>
> Can you recover c and d given e? c and d are not
> necessarily unique so it suffices to compute c1 and d1
> such that e -: a.{~ c1 (d1 b.) i.256 .
>
FWIW, here's my BF solution
I only use the ascii-codes:
fb=: 13 : 'x (y b.) i.256'
gb=: 13 : 'y fb"0 [16+i.16'
NB. coded example
ex=: 5 (23 b.) i.256
NB. decoding
(([:<.16%~]),.(16+16|])) I. 256= +/"1 (ex="1 ,/gb"0 i.16 )
5 23
Multiple solution example:
(([:<.16%~]),.(16+16|])) I. 256= +/"1 ((0 (31 b.) i.256)="1 ,/gb"0
i.16 )
0 28
0 29
0 30
0 31 <-------
1 31
2 31
3 31
4 31
5 31
6 31
7 31
8 31
9 31
10 31
11 31
12 31
13 31
14 31
15 31
(15 fb 31) -: 0 fb 31
1
(7 fb 31) -: 0 fb 31
1
a.{~q:9991
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm