MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / bigFactorial

Function bigFactorial

project_euler/problem_20/problem20.go:29–37  ·  view source on GitHub ↗

bigFactorial returns the factorial of n as a big.Int Use big package to handle large numbers

(n int)

Source from the content-addressed store, hash-verified

27// bigFactorial returns the factorial of n as a big.Int
28// Use big package to handle large numbers
29func bigFactorial(n int) *big.Int {
30 if n < 0 {
31 return big.NewInt(0)
32 }
33 if n == 0 {
34 return big.NewInt(1)
35 }
36 return big.NewInt(0).Mul(big.NewInt(int64(n)), bigFactorial(n-1))
37}

Callers 1

Problem20Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected