[seqfan] Re: 2 seqs with diffs distinct
Alois Heinz
heinz at hs-heilbronn.de
Sat Mar 27 18:20:22 CET 2010
A = 0, 1, 7, 18, 35, 59, 88, 125, 127, 189, 257, 327, 388, 480, 550,
558, 774, 812, 850, 1123, 1176, 1274, 1546, 1617, 1797, 1801, 2247,
2466, 2546, 2946, 3181, 3695, 3766, 4073, 4631, 4771, 5400, 5814, 5914,
6428, 6840, 7127, 7937, 8038, 8637, 8791, 9739, 10035, 10910, 10944,
11309, 13010, 13481, 14102, 14602, 14639, 16261, 16774, 17466, 17565,
18577, 19175, 21018, 21709, 22502, 22994, 24231, 25519, 25600, 25822,
26245, 28408, 30404, 30810, 31939, 32233, 34293, 35434, 37543, 38775
B = 0, 3, 12, 26, 45, 72, 105, 149, 161, 218, 278, 357, 430, 439, 616,
636, 679, 705, 984, 1007, 1338, 1411, 1471, 1749, 1864, 2067, 2082,
2687, 2762, 3113, 3430, 3514, 3992, 4261, 4407, 5162, 5594, 6118, 6172,
6734, 6766, 7494, 7596, 8212, 9099, 9332, 9510, 10288, 10642, 11712,
12574, 12734, 13765, 14366, 15131, 15739, 16021, 16624, 17020, 18500,
20148, 20345, 21227, 21788, 23545, 23821, 24754, 24843, 26910, 27321,
28762, 29074, 30004, 31640, 32753, 33921, 34974, 36155, 38415, 39501
ab:=proc() false end: ab(0):=true:
a:= proc(n) option remember;
local ok,i,k;
if n=1 then 0
else b(n-1);
for k from a(n-1)+1 do
ok:=true;
for i from 1 to n-1 do
if ab(abs(k-b(i))) then ok:= false; break fi
od;
if ok then break fi
od;
for i from 1 to n-1 do
ab(abs(k-b(i))):=true
od;
k
fi
end:
b:= proc(n) option remember;
local ok,i,k;
if n=1 then 0
else a(n);
for k from b(n-1)+1 do
ok:=true;
for i from 1 to n do
if ab(abs(k-a(i))) then ok:= false; break fi
od;
if ok then break fi
od;
for i from 1 to n do
ab(abs(k-a(i))):=true
od;
k
fi
end:
seq (a(n), n=1..80);
seq (b(n), n=1..80);
Alois
N. J. A. Sloane schrieb:
> i was talking to Richard Guy this morning and the following
> sequences came up
>
> we want A = a1 a2 a3 a4 ... and B = b1 b2 b3 ...
> such that
> 1. all the terms are nonnegative integers
> 2. The terms of A are strictly increasing
> 3. The terms of B are strictly increasing
> 4. All the numbers |A_i - B_j| are distinct
>
> There are many solutions. One might try looking for
> the earliest A in lexicographic order. Or , alternatively,
> look for the earliest { A union B}, which is probably better.
>
> Some scribbling suggests that we might end up with
> A = 0 1 7 18 35 ...
> B = 0 3 12 26 45 ...
>
> Could someone program this up?
>
> Neil (at the G4G9 conference)
>
More information about the SeqFan
mailing list