7

A permutation is a sequence $(a_1, \ldots, a_n)$ in which each number $1, \ldots, n$ appears precisely once. We call a sequence anti-arithmetic if there are no non-trivial arithmetic subsequences in it; that is, if there are no $i < j < k$ such that $(a_i, a_j, a_k)$ is an arithmetic sequence.

An example of an anti-arithmetic sequence of length 6 is $$ (3, 5, 4, 6, 1, 2). $$

Intuitively it seems "hard" to me for a long sequence to be anti-arithmetic. For example, suppose that you have built about half the sequence so far; then adding any element $a$ near $n/2$ requires that the elements of $1, \ldots, n$ you have used so far mirror (almost) exactly around $a$, and there are lots of ways for this to go wrong.

In particular, I do not know how to create anti-arithmetic sequences of arbitrary length.

Are there anti-arithmetic sequences of arbitrarily high length? How can I construct those?


I am asking this question because of Kattis problem Antiarithmetic?; googling the word "antiarithmetic" gets me only references to this recreational programming problem. I am not looking for a solution to the problem, only for some more intuition about antiarithmetic sequences.


Edit: Some programming strongly suggests that such anti-arithmetic sequences continue to appear for higher $n$. The following (unoptimized, but a fair bit faster than brute force) script shows anti-arithmetic sequences of length up to 40 very quickly, and that there are about 74904 such sequences of length 15.

def extend_aas(length, partial_sequence=[]):
    results = []
    for i in range(length):
        if i in partial_sequence:
            continue
        for j in partial_sequence:
            if 0 <= i + i - j < length and (i + i - j not in partial_sequence):
                break
        else:
            yield partial_sequence + [i]

def get_aases(length, partial=[]):
    for extended in extend_aas(length, partial):
        if len(extended) == length:
            yield extended
        else:
            for result in get_aases(length, extended):
                yield result

for n in range(1, 41):
    print(n, next(get_aases(n)))

for n in range(1, 16):
    print(n, len(list(get_aases(n))))

However, this still does not give me intuition for why this might be the case.

Mees de Vries
  • 27,550
  • Couldn't you simply reorder $\mathbb{Z}$, for example, such that you have $(0,1,-1,2,-2,3,-3,\cdots)$? – JacobCheverie Apr 16 '19 at 13:31
  • @JacobCheverie Then $i = 1, j = 3, k = 5$ gives the arithmetic sequence $(0, -1, -2)$. – Arthur Apr 16 '19 at 13:41
  • @Arthur I thought you just couldn't have three in a row. I read Kattis and I see the issue with my thinking. Thanks – JacobCheverie Apr 16 '19 at 14:21
  • I agree with your intuition that this seems very difficult for large $n$. Have you tried coding this up to find such sequences for $n=7, 8, 9$ etc? – antkam Apr 16 '19 at 14:41
  • @antkam I have not, but I have some reason to believe that large such sequences exist (I'm being purposely vague here). Let me see if I can find them for the $n$ you suggest with a quick script.... – Mees de Vries Apr 16 '19 at 14:48
  • @antkam, in fact there are quite many for $n \leq 9$. Here is the lexographically last for $n = 9$: $$(9, 1, 5, 7, 8, 3, 4, 6, 2)$$ – Mees de Vries Apr 16 '19 at 14:55
  • Isn't Szemeredi's theorem the answer to your question? I had no time to go into details, so I might be wrong. – rss Apr 16 '19 at 15:27
  • @rss, not as far as I can tell. Szemeredi's theorem is about infinite subsets of the naturals, while my problem is about permutations of a finite initial segment. – Mees de Vries Apr 16 '19 at 15:29
  • @rss, in particular note that the order is very important here: if a sequence has $4, 3$ somewhere in it, that means $2$ must have appeared before, but $5$ may still appear after. – Mees de Vries Apr 16 '19 at 15:30
  • There is an equivalent form of Szemeredi's theorem (e.g. https://en.m.wikipedia.org/wiki/Szemerédi%27s_theorem), I thought this form would have been useful. Nevertheless, I see your point now, indeed this theorem won't help you. – rss Apr 16 '19 at 15:35

1 Answers1

7

Yes, there are anti-arithmetic sequences (AASs) of any length.

If $(a_1, \ldots, a_n)$ and $(b_1, \ldots, b_n)$ are AASs of length $n$, then we claim that $$ (2a_1, \ldots, 2a_n, 2b_1 - 1, \ldots, 2b_n-1) $$ is an AAS of length $2n$. Indeed it is clear that every integer $1, \ldots, 2n$ appears precisely once, the even ones in the first half and the odd ones in the second half. Furthermore, suppose towards a contradiction that it contains a non-trivial arithmetic sequence. If that sequence is of the form $(2a_i, 2a_j, x)$ then we must have that $x$ is even, therefore $x = 2a_k$. But then $(a_i, a_j, a_k)$ would be an arithmetic sequence in $(a_1, \ldots, a_n)$. For a similar reason,we cannot have an arithmetic sequence $(2b_i - 1, 2b_j - 1, x)$. Finally, a sequence $(2a_i, 2b_j - 1, x)$ cannot be arithmetic either, because $x$ would have to be even, but no even number occurs after an odd one.

Since there is at least one anti-arithmetic sequence, there are arbitrariy long anti-arithmetic sequences. From a longer AAS we can always make a shorter one by simply taking only the lower numbers from the sequence, so there are AASs of any length.

Note furthermore that you can reverse the order of the odd and even parts, and the same argument goes through. This means that if there are $k$ AASs of length $n$, then this construction gives $2k^2$ different AASs of length $2k$. Since there is trivially 1 AAS of length 1, this tells us that there are at least $2^{2^n - 1}$ AASs of length $2^n$. Since the number of AASs of length $n$ is bounded by the greatest power of 2 below $k$ and the least power of 2 greater than $k$, this in particular shows that there are exponentially many length $k$ AASs.

Mees de Vries
  • 27,550
  • 1
    nice! i tried on and off today to generalize from a shorter sequence to a longer one. turns out the key is to generalize from TWO shorter sequences. :) – antkam Apr 17 '19 at 07:10
  • 1
    @antkam, the idea came from your suggestion to find some more sequences; when looking at the output of the code I noticed that the AASs I found tended to have many elements with the same parity at the beginning. So, thank you for the inspiration! – Mees de Vries Apr 17 '19 at 10:47