Skip to content

Instantly share code, notes, and snippets.

@angch
Last active November 1, 2016 10:37
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 angch/39dab89321d170e20d38da3bbd307a94 to your computer and use it in GitHub Desktop.
Save angch/39dab89321d170e20d38da3bbd307a94 to your computer and use it in GitHub Desktop.
Naive Go factorial. Can't run in Go playground, too slow.
// real 0m0.638s
// user 0m0.621s
// sys 0m0.015s
package main
import (
"fmt"
"math/big"
)
func f(n int64) *big.Int {
ret := big.Int{}
return ret.MulRange(1, n)
}
func main() {
fmt.Println(f(100000))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment