[seqfan] Re: 2 seqs with diffs distinct (correction)

Alois Heinz heinz at hs-heilbronn.de
Sat Mar 27 19:04:54 CET 2010


I'm sorry, my last post contained an error, 127 in A and 105, 149 in B.
Here are the correct sequences:

A = 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, 5388, 5968, 
6478, 6756, 7344, 7698, 8004, 8182, 9235, 9330, 9660, 10447, 11061, 
11067, 12275, 13155, 13509, 14204, 14368, 15787, 16872, 17487, 18469, 
18802, 20078, 20509, 21685, 22287, 23900, 24016, 25074, 26979, 27639, 
29090, 29577, 31195, 32223, 32247, 34184, 35000, 36631, 37188, 38917

B = 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, 5535, 6228, 
6233, 7134, 7515, 7861, 8619, 8745, 8899, 9712, 9829, 10859, 11635, 
12387, 12572, 12682, 13706, 14080, 14916, 16484, 16687, 18121, 18651, 
19089, 20406, 21059, 22365, 22697, 22700, 24754, 25955, 27482, 28214, 
28763, 30321, 30607, 33323, 33474, 35331, 35343, 35928, 38671, 39218

ab:=proc() false end: ab(0):=true:
a:= proc(n) option remember;
  local ok,i,k,s;
  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 s:={};
                   for i from 1 to n-1 do
                     s:= s union {abs(k-b(i))};
                   od
        fi;
        if ok and nops(s)=n-1 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,s;
  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 s:={};
                   for i from 1 to n do
                     s:= s union {abs(k-a(i))};
                   od
        fi;
        if ok and nops(s)=n 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






More information about the SeqFan mailing list