ROSECODE 158
编程练习 - 计数
Programming exercise - Counting
让下面的函数
function(n)
begin
count = 0
for i in 1 to n
for j in (i+1) to n
if 1 = GCD(i,j)
count = count+1
return count
end
What is function(123456789)
You are given: function(10^5) = 3039650753
[My timing: 80 sec]
P.S: I slightly changed the parameter (and the answer) as the original solution might be easily found on the web.