login
Lexicographically earliest infinite sequence of nonnegative integers, {a(n)} for n>=0, such that all lines with equations y = a(n)*x + n are in general position.
1

%I #52 Oct 08 2023 09:56:49

%S 0,1,3,2,5,4,8,11,6,13,12,7,22,16,17,21,9,14,10,27,18,15,19,28,31,43,

%T 34,38,23,39,25,36,41,20,55,63,42,30,24,33,26,32,65,66,51,59,29,56,35,

%U 62,85,81,37,49,46,68,74,78,88,48,44,75,40,47,97,76,93,79,92,54,58,100,61,101,107,52

%N Lexicographically earliest infinite sequence of nonnegative integers, {a(n)} for n>=0, such that all lines with equations y = a(n)*x + n are in general position.

%C By "in general position" we mean that no two lines are parallel or coincident, and no three are concurrent.

%H Luc Rousseau, <a href="/A364311/a364311.png">Illustration, the first five lines</a>

%e Line #0 is y = 0*x + 0, as no constraint other than the default one (lexicographically earliest) applies yet, so a(0)=0;

%e Line #1 cannot be y = 0*x + 1, as the reuse of the slope of a previously defined line implies parallelism; but it can be y = 1*x + 1, so a(1)=1;

%e Line #2 cannot be y = 2*x + 2, as lines #0, #1 and #2 would be concurrent at (-1,0); but Line #2 can be y = 3*x + 2, so a(2)=3; ...

%o (PARI)

%o g(n,an,p)=my(b=1);for(i=1,#p,if(p[i][2]==an*p[i][1]+n,b=0;break));b

%o c(n,s,p)=my(an=0);while((setsearch(s,an,0)!=0)||!g(n,an,p),an++);an

%o w(n,a,an,p)=for(m=0,#a-1,my(am=a[1+m]);listput(p,[(m-n)/(an-am),(am*n-an*m)/(am-an)]));p

%o list_a(N)=my(a=List(),s=List(),p=List(),n=0,an);while(n<=N,an=c(n,s,p);p=w(n,a,an,p);listput(a,an);listinsert(s,an,setsearch(s,an,1));n++);Vec(a)

%o list_a(75)

%Y Cf. A000217 (number of intersection points to avoid after line #n is created).

%K nonn

%O 0,3

%A _Luc Rousseau_, Sep 22 2023