login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A169677 The first of a pair of sequences A and B with property that all the differences |a_i - b_j| are distinct - for precise definition see Comments lines. 6

%I #18 Jan 09 2015 13:13:32

%S 0,1,7,18,35,59,88,125,178,233,285,344,352,442,557,675,796,797,957,

%T 1011,1220,1411,1564,1579,1888,2120,2152,2503,2829,2953,3393,3464,

%U 3593,3724,4237,4956,5310,5388,5968,6478,6756,7344,7698,8004,8182

%N The first of a pair of sequences A and B with property that all the differences |a_i - b_j| are distinct - for precise definition see Comments lines.

%C Consider pairs of sequences A = a_1 a_2 a_3 a_4 ... and B = b_1 b_2 b_3 ... such that

%C 1: All the terms are nonnegative integers

%C 2: The terms of A are strictly increasing

%C 3: The terms of B are strictly increasing

%C 4: All the numbers |a_i - b_j| are distinct

%C 5: The terms are computed in the following order: a(1), b(1), a(2), b(2), ..., b(n-1), a(n), b(n), a(n+1), ... and always the smallest value is chosen that satisfies constraints 1-4.

%C Computed by _Alois P. Heinz_ and _Wouter Meeussen_, Mar 27 2010

%H Alois P. Heinz, <a href="/A169677/b169677.txt">Table of n, a(n) for n = 1..200</a>

%p # Maple program from _Alois P. Heinz_:

%p ab:=proc() false end: ab(0):=true:

%p a:= proc(n) option remember;

%p local ok,i,k,s;

%p if n=1 then 0

%p else b(n-1);

%p for k from a(n-1)+1 do

%p ok:=true;

%p for i from 1 to n-1 do

%p if ab(abs(k-b(i))) then ok:= false; break fi

%p od;

%p if ok then s:={};

%p for i from 1 to n-1 do

%p s:= s union {abs(k-b(i))};

%p od

%p fi;

%p if ok and nops(s)=n-1 then break fi

%p od;

%p for i from 1 to n-1 do

%p ab(abs(k-b(i))):=true

%p od;

%p k

%p fi

%p end;

%p b:= proc(n) option remember;

%p local ok,i,k,s;

%p if n=1 then 0

%p else a(n);

%p for k from b(n-1)+1 do

%p ok:=true;

%p for i from 1 to n do

%p if ab(abs(k-a(i))) then ok:= false; break fi

%p od;

%p if ok then s:={};

%p for i from 1 to n do

%p s:= s union {abs(k-a(i))};

%p od

%p fi;

%p if ok and nops(s)=n then break fi

%p od;

%p for i from 1 to n do

%p ab(abs(k-a(i))):=true

%p od;

%p k

%p fi

%p end;

%p seq(a(n), n=1..80);

%p seq(b(n), n=1..80);

%t ClearAll[ab, a, b]; ab[_] = False; ab[0] = True; a[n_] := a[n] = Module[{ ok, i, k, s}, If[ n == 1 , 0, b[n-1]; For[ k = a[n-1] + 1 , True, k++, ok = True; For[ i = 1 , i <= n-1, i++, If[ ab[Abs[k - b[i]]] , ok = False; Break[] ]]; If[ ok , s = {}; For[ i=1 , i <= n-1 , i++, s = s ~Union~ {Abs[k - b[i]]};]]; If[ ok && (Length[s] == n-1) , Break[] ]]; For[ i=1 , i <= n-1 , i++, ab[Abs[k - b[i]]] = True]; k]]; b[n_] := b[n] = Module[{ ok, i, k, s}, If[ n == 1 , 0, a[n]; For[ k = b[n-1] + 1 , True, k++, ok = True; For[ i=1 , i <= n, i++, If[ ab[Abs[k - a[i]]] , ok = False; Break[] ]]; If[ ok , s = {}; For[ i=1 , i <= n , i++, s = s ~Union~ {Abs[k - a[i]]};]]; If[ ok && Length[s] == n , Break[] ]]; For[ i=1 , i <= n, i++, ab[Abs[k - a[i]]] := True]; k]]; Table[a[n], {n, 1, 45}] (* _Jean-François Alcover_, Aug 13 2012, translated from _Alois P. Heinz_'s Maple program *)

%Y Cf. A169678, A169679, A169680, A169690-A169693.

%K nonn,nice

%O 1,3

%A _R. K. Guy_ and _N. J. A. Sloane_, Mar 27 2010

%E Comments clarified by Zak Seidov and _Alois P. Heinz_, Apr 13 2010.

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 04:13 EDT 2024. Contains 371235 sequences. (Running on oeis4.)