# Generate A065825

## Pyth, 17 bytes

ff!/#.OZ.cY3.cSTQ


Try it online!

.cSTQ: generate all list of numbers in the range [1,T] with length equal to the input.

.cY3: for each of those, generate all length 3 subsequences.

/#.OZ: filter for the subsequences where the average is a member of the list. These are the arithmetic progressions.

f!: filter for the original lists with no arithmetic progressions

f: find the lowest T where at least one list is found.

## Python 3.8, 12311596 94 bytes

Another -15 -17 bytes thanks to Surcolose Sputum!

f=lambda n,k=1:len(d:=f'{k:b}')*all(k>>i&k&k<<i<1for i in range(d.count('1')//n,k))or f(n,k+1)


Try it online!

## Python 2, 147135 124 bytes

-11 bytes thanks to Surcolose Sputum!

from itertools import*
f=lambda n,k=1,C=combinations:k*any(all(a+c-b*2for a,b,c in C(w,3))for w in C(range(k),n))or f(n,k+1)


Try it online!

## R, 96 83 bytes

k=n=scan();C=combn;[=Map;try(while(!any(all[diff[C[C(1:k,n,,F),3],1,2]]))k=k+1);k


Try it online!

Full program, returns 1-indexed member of the sequence. Very slow for n > 8.