Revision 03f2959c-ec31-477c-8a10-bf197ec9cfe2 - Code Golf Stack Exchange

#[MATL](https://github.com/lmendo/MATL), 17 <s>20</s> bytes

This uses [current version (5.0.0)](https://github.com/lmendo/MATL/releases/tag/5.0.0) of the language.

Approach based on [@flawr's answer](http://codegolf.stackexchange.com/a/67818/36398).

 i:tg!X*t!Zd1=Y)Ym

_Edit (April 28, 2015)_: [Try it online!](http://matl.tryitonline.net/#code=aTp0ZyFYKnQhWmQxPVg6WW0&input=MTAw) After this answer was posted, function `Y)` was renamed to `X:`; the link includes that change.

###Example

 >> matl i:tg!X*t!Zd1=Y)Ym
 > 100
 0.6087

###Explanation

 i: % vector 1, 2, ... up to input number
 tg! % copy, convert into ones, transpose
 X* % Kronecker product. Produces a matrix
 t! % copy, transpose
 Zd % gcd of all pairs
 1= % is it equal to 1?
 Y) % linearize into column array
 Ym % compute mean

---

Old answer: __20 bytes__

 Oi:t"t@Zd1=sb+w]n2^/

__Explanation__

 O % produce literal 0. Initiallizes count of co-prime pairs.
 i % input number, say N
 : % create vector 1, 2, ... N
 t % duplicate of vector
 " % for loop
 t % duplicate of vector
 @ % loop variable: each element from vector
 Zd % gcd of vector and loop variable. Produces a vector
 1=s % number of "1" in result. Each "1" indicates co-primality
 b+w % accumulate into count of co-prime pairs
 ] % end
 n2^/ % divide by N^2

AltStyle によって変換されたページ (->オリジナル) /