I was doing a test comparison in performance between Go and Kotlin and decided to test out how the two compare in regards to calculating the `N`

th prime number. From my testing, I found that on average, Go took around twice the amount of time to calculate any `N`

th prime number that Kotlin took. For instance, if Kotlin took `~250,000ns`

to calculate the 100th prime, then Go took `~500,000ns`

.

As an aside, I’m aware of optimizations of calculating the `N`

th prime number, such as the Sieve of Eratosthenes, but I was originally using these two functions to simulate heavy computational work in a RESTful microservice. I posted the two functions I used below.

Is Kotlin simply faster than Go in this regard? Or is there something else I’m missing?

Thank you so much

```
fun simplePrime(primeN : Int) : Int {
var primeI = 0
var currNum = 1
while (primeI < primeN) {
currNum += 1
var isPrime = true
for (i in 2..currNum/2) {
if (num % i == 0) {
isPrime = false
break
}
}
if (isPrime) {
primeI += 1
}
}
return currNum
}
```

```
func getNthPrime(num int) int {
primeNum := 0
currNum := 1
for primeNum < num {
currNum++
isPrime := true
for i := 2; i < currNum/2; i++ {
if currNum % i == 0 {
isPrime = false
break
}
}
if isPrime {
primeNum++
}
}
return primeNum
}
```