主题:[讨论]我关于既约数的编程,不知错在哪里?求大虾指点
题目:求出所有分母小于等于N的既约真分数的个数
type int=1..100000;
var number,i,o,a,b,u:int;
ch:array[1..300000] of real;
begin
readln(number);
for o:=2 to number do
for i:=1 to number-1 do begin
if(i div o)=0
then begin a:=a+1;ch[a]:=i/o;end else break;
for u:=1 to a-1 do
if ch[a]=ch[u]
then begin ch[u]:=1;break;end;end;
for i:=1 to a do
if(ch[i]<>1) then b:=b+1;
write(b);
end.
type int=1..100000;
var number,i,o,a,b,u:int;
ch:array[1..300000] of real;
begin
readln(number);
for o:=2 to number do
for i:=1 to number-1 do begin
if(i div o)=0
then begin a:=a+1;ch[a]:=i/o;end else break;
for u:=1 to a-1 do
if ch[a]=ch[u]
then begin ch[u]:=1;break;end;end;
for i:=1 to a do
if(ch[i]<>1) then b:=b+1;
write(b);
end.