N <- 1000 x <- runif(N) y <- runif(N) logic <- (x^2+y^2)^2 <= x^2-y^2 K <- length(which(logic)) print(K/N*4)