Witam, mam napisaną procedurę dla obliczenia i wypisania licz bliźniaczych z zakresu od 1 do n , ale problem występuje np, przy wpisaniu w editbox'a liczby 5500:
oto kod
procedure TForm1.Button1Click(Sender: TObject);
var
t : array of boolean;
tablica : array of cardinal;
i,w,g : cardinal;
stra,stra2,strall : string;
t1,t3,dlugosc : integer;
begin
g:=StrToInt(Edit1.text);
SetLength(t,g);
SetLength(tablica,g);
begin
for i := 2 to g do t[i] := true;
for i := 2 to g do
begin
w := i + i;
while w <= g do
begin
t[w] := false;
w := w + i;
end;
end;
t3:=0;
for i := 2 to g do
begin
if t[i]=true then
begin
t3:=t3+1;
tablica[t3]:=i;
end;
end;
dlugosc:=t3;
t1:=0;
begin
listBox1.Items.clear();
repeat
t1:=t1+1;
if tablica[t1] >4 then
begin
if tablica[t1]-tablica[t1-1]=2 then
begin
stra:=intToStr(tablica[t1]);
stra2:=intToStr(tablica[t1-1]);
strall:= stra2 + ' i ' + stra;
listBox1.Items.Add(strall);
end;
end;
until t1=dlugosc;
end;
end;
Po wpisaniu wywala błąd: invalid pointer operation,
Proszę o pomoc