Ruby, 122 77 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
.
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
.