# A sequence unique including differences

franktaw at netscape.net franktaw at netscape.net
Fri May 30 02:12:48 CEST 2008

```I'm surprised that the following was not already in the OEIS:

%I A140778
%S A140778
1,3,7,12,18,8,17,28,13,27,43,19,39,60,22,45,70,26,55,85,31,63,96,34,69,10
5,37,77,
118,42,88,135,48,97,147,52,103,156,56,113,171,59,120,184,65,131,198,71,14
3,216,74,
149,227,79,159,240,82,165,249,86,175,265,91,183,276,94,192,291,101,203,30
7,106,
213,321,109,219,330,115,229,345,117,238,360,123,247,372,126,254,383,130,2
62,395,
134,270,407,138,277,417,144,285
%N A140778 a(n) is the smallest positive integer such that no number
occurs
twice in the sequence and its absolute first differences.
%C A140778 This sequence and its first differences include every
positive
integer (exactly once).
%e A140778 For a(5), the sequence to that point is [1,3,7,12], with
absolute
differences [2,4,5].  The next number cannot be 6, because then 6 would
be in
both the sequence and the first differences.  Since all values smaller
than 6
are taken, the difference must be positive and at least 6.  A
difference of 6
works, a(5) = 18.
%o A140778 (PARI) IsInList(v, k) =
for(i=1,#v,if(v[i]==k,return(1)));return(0)
IsInDiff(v, k) = for(i=2,#v,if(abs(v[i]-v[i-1])==k,return(1)));return(0)
NextA140778(v)={
local(i,d);
if(#v==0,return(1));
i=2;
while(1,
d=abs(i-v[#v]);
if(!(i==d || IsInList(v,i) || IsInDiff(v,i) || IsInList(v,d) ||
IsInDiff(v,d)), return(i));
i++)
}
v=[];for(i=1,100,v=concat(v,NextA140778(v)));v
%Y A140778 Cf. A140779, A081145.
%O A140778 1
%K A140778 ,easy,nonn,
%A A140778 Franklin T. Adams-Watters (FrankTAW at Netscape.net), May 29
2008

Question: can an upper bound for a(n)/n be established?  If so, what is
the least upper bound?  Up to n=100, the maximum is n=74, a(n) = 321,
a(n)/n ~ 4.338.

The same question can be asked for A081145; the maximum for the values
in the database is n=51, a(n) = 115, a(n)/n ~ 2.255.