``````

{\$R *.DFM}

procedure TForm1.Check32BtnClick(Sender: TObject);
{We're checking X^4-X^2 values so we can uses X values
up to 4th root of maxinteger}
var i,stop,errcount:integer;
begin
{power returns 4th root of highest possible value for i,(high(i))}
{trunc converts it from a real nbr to the next lower integer}
stop:=trunc(power(high(i),0.25));
errcount:=0;
For i := 2 to stop do
if (i*i*(i*i-1)) mod 12 >0 then inc(errcount); {just count any errors}``````
``````
showmessage('Done - all integers between 2 and '
+inttostr(stop) +' checked, '+inttostr(errcount)
+' were not multiples of 12');
end;

procedure TForm1.Check64BtnClick(Sender: TObject);
{Same thing as above, but with long integers}
var i,stop:int64;
errcount:integer;
begin
stop:=trunc(power(high(i),0.25));
i:=2;
errcount:=0;
{DO loop control variable only operates on 32 bit integer values}
{So we'll use a WHILE loop}
While i<= stop do
begin
if (i*i*(i*i-1)) mod 12 >0 then inc(errcount); {just count any errors}
inc(i);
end;
showmessage('Done - all integers between 2 and '
+inttostr(stop) +' checked, '+inttostr(errcount)
+' were not multiples of 12');
end;

end.

``````