Skip to content

Instantly share code, notes, and snippets.

@gebi
Created March 18, 2013 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gebi/5188792 to your computer and use it in GitHub Desktop.
Save gebi/5188792 to your computer and use it in GitHub Desktop.
package main
import (
"os"
"fmt"
"log"
"strconv"
"github.com/cznic/mathutil"
)
func main() {
i, err := strconv.ParseUint(os.Args[1], 0, 64)
if err != nil {
log.Fatal("Could not parse number: \"", os.Args[1], "\"")
}
prime, ok := mathutil.NextPrimeUint64(i)
if !ok {
log.Fatal("Could not find next prime for: ", i)
}
fmt.Println(prime)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment