Skip to content

Instantly share code, notes, and snippets.

@avelino
Created October 15, 2017 15:58
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 avelino/2266fc463ac021af99cb85664f2627b1 to your computer and use it in GitHub Desktop.
Save avelino/2266fc463ac021af99cb85664f2627b1 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func fact(n int) int {
if n == 0 {
return 1
}
return n * fact(n-1)
}
func main() {
t := 0
for j := 0; j < 100000; j++ {
for i := range []int{1, 2, 3, 4, 5, 6, 7, 8} {
t += fact(i)
}
}
fmt.Println("total: ", t)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment