#Ruby, <s>122</s> <s>77</s> 65 bytes Thanks to Sherlock for shaving off 10 bytes. require'prime' ->n{Prime.take(n).map{|x|1-2r/(x*x+1)}.reduce(:*)} Defines an anonymous function that takes a number and returns a `Rational`.