Skip to content

Factorial

admin edited this page Jun 15, 2021 · 4 revisions

Factorial

Факториал числа. Агентство цифровых технологий

The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic use counts the possible distinct sequences – the permutations – of n distinct objects: there are n!.

Intro

Go License Website dta.agency GitHub release

import "github.com/digital-technology-agency/math"

func Example() {
    n := 4
    value := math.FactorialInt(n)
	fmt.Printf("Result: %d", value)
    /*
        Result: 24    
    */ 
}

Recalculate factorial with tree

import "github.com/digital-technology-agency/math"

func Example() {
    n := 4
    value := math.FactorialTreeString(n)
	fmt.Printf("Result: %s", value)
    /*
        Result: 24    
    */ 
}
Clone this wiki locally