J, 27 Bytes
3 :'%:6*y%+/(1:=?+.?)y#1e6'
Explanation:
3 :' ' | Explicit verb definition
y#1e6 | List of y copies of 1e6 = 1000000
(1:=?+.?) | for each item, generate i and j, and test whether their gcd is 1
+/ | Sum the resulting list
6*y% | Divide y by it and multiply by six
%: | Square root
Got pretty lucky with a 3.14157 for N = 10000000, which took 2.44 seconds.
Bolce Bussiere
- 1.1k
- 8
- 9