# [seqfan] Re: 2 seqs with diffs distinct

wouter meeussen wouter.meeussen at pandora.be
Sat Mar 27 19:26:43 CET 2010

```even better to use two incrementing counters instead of one:

{0, 1, 7, 18, 35, 59, 88, 125, 178, 233, 285, 344, 352, 442, 557, 675, 796,
797, 957, 1011, 1220, 1411, 1564, 1579, 1888, 2120, 2152, 2503, 2829, 2953,
3393, 3464, 3593, 3724, 4237, 4956, 5310}
and
{0, 3, 12, 26, 45, 72, 105, 149, 199, 255, 316, 392, 401, 502, 596, 733,
865,
891, 1086, 1119, 1311, 1330, 1646, 1773, 2011, 2324, 2371, 2554, 2692, 3055,
3258, 3820, 3960, 4063, 4606, 5126, 5515}

aa={0};bb={0};x=y=0;
Table[While[!UnsameQ@@(it=Flatten[Outer[Abs[#1-#2]&,Append[aa,x],bb]]),x++];
AppendTo[aa,x];
While[!UnsameQ@@(it=Flatten[Outer[Abs[#1-#2]&,Append[bb,y],aa]]),y++];
AppendTo[bb,y]; ,{n,36}];{aa,bb}

Wouter²

> I prefer:
> {0, 1, 7, 18, 35, 59, 88, 125, 178, 233, 285, 344, 428, 516, 623, 705,
813,
> 951, 1086, 1225, 1386, 1528, 1759, 1960, 2160, 2381, 2584, 2808, 3042,
3260,
> 3563, 3844, 4182, 4471, 4846, 5392, 5553}
> with
> {0, 3, 12, 26, 45, 72, 105, 149, 199, 255, 316, 392, 467, 571, 663, 762,
876,
> 1017, 1167, 1322, 1468, 1638, 1867, 2051, 2313, 2481, 2767, 2924, 3134,
3406,
> 3682, 4014, 4278, 4745, 4973, 5459, 5848}
>
> and my apologies for the dumbest program I've ever written:
clip
> Wouter.
>

```