var i, k, a: integer;
function f(x: integer; y: integer): integer;
begin
if y = 0 then f := x else f := f(y, x mod y)
end;
begin
k := 0;
readln(a);
for i := 1 to a do
if f(a, i) = i then k := k + 1;
writeln(k);
end.
|
int f (int x, int y)
{
if(y==0) return x;
else return f(y, x%y);
}
main()
{
int i,k=0,a;
scanf("%d", &a);
for(i=1; i<=a; i++)
if(f(a,i)==i) k++;
printf("%d",k);
}
|
def f(x, y):
if y == 0:
return x
else:
return f(y, x % y)
k = 0
a = int(input())
for i in range (1, a+1):
if f(a, i) == i:
k += 1
print (k) |