# [seqfan] Re: Is the definition of this sequence correct?

M. F. Hasler oeis at hasler.fr
Mon Jul 4 14:26:57 CEST 2022

```Oh sorry, the " > " in my final version is wrong again, I mixed up
reasoning "in the other direction"
(minimum distance remains the smaller of the two values).
I think it should be OK with ">=".
As a redemption, I provide a PARI program:

{A=U=[1]; for(n=1, 99, for(k=U[1]+1,oo,
(setsearch(U,k) || setsearch(Set(A[max(-n,2-k)..-1]),k-1) ||
setsearch(Set(A[max(-n,1-k)..-1]), k+1)) && next;
if(k>U[1]+1, U=setunion(U,[k]), U[1]+=1; while(#U>1&& U[1]+1==U[2],
U=U[^1])); A=concat(A,k); break));A}

=> 1, 2, 4, 6, 8, 3, 10, 12, 5, 14, 16, 7, 18, 20, 22, 9, 24, 26, 11, 28,
30, 32, 13, 34, 36, 15, 38, 40, 42, 17, 44, 46, 19, 48, 50, 21, 52, 54, 56,
23, 58, 60, 25, 62, 64, 66, 27, 68, 70, 29, 72, 74, 31, 76, 78, 80, 33, 82,
84, 35, 86, 88, 90, 37, 92, 94, 39, 96, 98, 41, 100, 102, 104, 43, 106,
108, 45, 110, 112, 114, 47, 116, 118, 49, 120, 122, 124, 51, 126, 128, 53,
130, 132, 55, 134, 136, 138, 57, 140, 142, ...

At that point, all numbers up to 57, and all odd numbers up to 141, are
used.

- Maximilian

On Mon, Jul 4, 2022 at 7:31 AM M. F. Hasler <oeis at hasler.fr> wrote:

> Dear Ali et al.,
> Now the example is clear and also "the other direction" had been clarified
> in the second proposal of name.
> This clarification confirms that you can/must actually require a minimum
> distance of a(n)+1 (because of the "other direction" you clarified using
> the index m2).
>
> Then I would suggest:
>
> a(n) is the least positive integer not already in the sequence such that,
> if a(m) = a(n)+1, then |m - n| > a(n).
>
> ( a(1)=1 follows from the definition.
> If we feel an urge to specify it, I'd suggest to put this to the end so
> that the main idea comes as early as possible in the "name", considering
> esp. the truncation of names in the "pop-up titles".)
>
> Or maybe better: (all numbers are "already in the sequence"...)
>
> Lexicographically first permutation of the positive integers such that, if
> a(m) = a(n)+1, then |m - n| > a(n), for all indices m and n.
>
> (We can use "permutation" as shortcut for "...not occurring earlier"
> because any integer will indeed occur, as soon a possible: the condition on
> the distance can only "delay" its occurrence a little bit.)
>
> - Maximilian
>
> On Sun, Jul 3, 2022, 21:43 Ali Sada via SeqFan <seqfan at list.seqfan.eu>
> wrote:
>
>>
>> Thank you, Tom. I really appreciate your response. It will take me some
>> time to write a VBA program to find the terms. Manually, I will make
>> mistakes!
>>
>> Would any of these two versions work?
>>
>> a(1)=1; a(n) is the least positive integer not already in the sequence
>> such that the absolute distance between a(n) and a(n)+1 is >= a(n).
>>
>> or
>>
>> a(1)=1; a(n) is the least positive integer not already in the sequence
>> such that |n-m1|>= a(n) and |n-m2|>= a(n)-1, where m1 and m2 are the
>> indices of a(n)+1 and a(n)-1 respectively.
>>
>> Best,
>>
>> Ali
>>
>>
>>
>>
>>     On Sunday, July 3, 2022 at 10:45:47 PM GMT+1, Tom Duff <
>> eigenvectors at gmail.com> wrote:
>>
>>  No, sorry, my definition is bogus. The sequence is more complicated than
>> I
>> made it out to be.
>>
>> On Sun, Jul 3, 2022 at 15:01 Tom Duff <eigenvectors at gmail.com> wrote:
>>
>> > I think this should read:
>> > a(1)=1; a(n+1) is the smallest positive integer, distinct from all a(m),
>> > m<=n, with |a(n+1)-a(n)|>=a(n).
>> >
>> > Sequences, not their entries, are “lexicographically earliest”. The way
>> a
>> > sequence gets to be lexicographically earliest is by picking the
>> smallest
>> > eligible entry at each step. “Distance … in both directions” is best
>> > expressed by explicitly saying that it’s the absolute difference.
>> > All that said, I’m surprised that this sequence is not already in the
>> > OEIS. Compute a bunch of terms (it’s easy, you shouldn’t need help) and
>> > search for it. If it’s not there, add it.
>> >
>> > On Sun, Jul 3, 2022 at 04:18 Ali Sada via SeqFan <seqfan at list.seqfan.eu
>> >
>> > wrote:
>> >
>> >> Hi everyone,
>> >>
>> >> Please check this definition
>> >>
>> >> a(1) =1; a(n) is the lexicographically earliest positive integer such
>> >> that the distance between a(n) and a(n)+1 is >= a(n) in both
>> directions.
>> >> (The distance between a(n) and a(m) is |n-m|)
>> >>
>> >> a(1) = 1
>> >> a(2) = 2
>> >> Now, a(3) cannot be 3, so a(3) = 4.
>> >> a(4) cannot be 3 nor 5, so a(4) = 6.
>> >> a(5) cannot be 3 nor 5 nor 7, so a(5) = 8.
>> >> Now, we can use 3 for a(6) (the distance with 4 is 3).
>> >> And so on.
>> >>
>> >> I would appreciate your help with the correct definition and terms.
>> >>
>> >> Best,
>> >>
>> >> Ali
>> >>
>> >> --
>> >> Seqfan Mailing list - http://list.seqfan.eu/
>> >>
>> >
>>
>> --
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>>
>> --
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>

```