procedure TForm1.tr1Change(Sender: TObject);
var d0,d1: Double;
Q,N: Integer;
begin
// 170111 x = (4NQ-Q^2+2Q-1)/(4N-Q^2-2Q+3)
Q:=tr1.Position;
cht1.Series[0].Clear;
cht1.Series[1].Clear; edt1.Text:='';
for N:=Q+1 to Q+100 do
begin
d0:=(4*N*Q-Q*Q+2*Q-1);
d1:=(4*N-Q*Q-2*Q+3);
if Abs(d1)<1e-4 then Continue;
d0:=d0/d1;
if d0<0 then Continue;
cht1.Series[0].AddXY(N,d0);
if Abs(d0-Round(d0))<1e-5 then
begin
cht1.Series[1].AddXY(N,d0);
edt1.Text:=edt1.Text+Format(' N=%d',[N]);
end;
end;
lbl1.Caption:=Format('Q=%d',[Q])
end;