这是一个实验

By: 忠文 邓
Posted: April 20, 2021

我爱编程

package prime

func Nth(number int) (int, bool) {
        if number < 1 {
                return 0, false
        }
        prime := 1
        for number > 0 {
                prime = next_prime(prime)
                number--
        }
        return prime, true
}

func next_prime(number int) int {
        number++
        for !is_prime(number) {
                number++
        }
        return number
}

func is_prime(number int) bool {
        for p := 2; p < number; p++ {
                if number%p == 0 {
                        return false
                }
        }
        return true
}

这是一行新的开始

An image from Notion