freeCodeCamp/curriculum/challenges/portuguese/08-coding-interview-prep/rosetta-code/gamma-function.portuguese.md

2.5 KiB

title id challengeType videoUrl localeTitle
Gamma function 5a23c84252665b21eecc7e76 5 Função gama

Description

Implemente um algoritmo (ou mais) para calcular a função Gamma ($ \ Gamma $) (somente no campo real). A função Gamma pode ser definida como:
$ \ Gamma (x) = \ displaystyle \ int_0 ^ \ infty t ^ {x-1} e ^ {- t} dt $

Instructions

Tests

tests:
  - text: <code>gamma</code> deve ser uma função.
    testString: 'assert(typeof gamma=="function","<code>gamma</code> should be a function.")'
  - text: '<code>gamma(&quot;+tests[0]+&quot;)</code> deve retornar um número.'
    testString: 'assert(typeof gamma(tests[0])=="number","<code>gamma("+tests[0]+")</code> should return a number.")'
  - text: '<code>gamma(&quot;+tests[0]+&quot;)</code> deve retornar <code>&quot;+results[0]+&quot;</code> .'
    testString: 'assert.equal(gamma(tests[0]),results[0],"<code>gamma("+tests[0]+")</code> should return <code>"+results[0]+"</code>.")'
  - text: '<code>gamma(&quot;+tests[1]+&quot;)</code> deve retornar <code>&quot;+results[1]+&quot;</code> .'
    testString: 'assert.equal(gamma(tests[1]),results[1],"<code>gamma("+tests[1]+")</code> should return <code>"+results[1]+"</code>.")'
  - text: '<code>gamma(&quot;+tests[2]+&quot;)</code> deve retornar <code>&quot;+results[2]+&quot;</code> .'
    testString: 'assert.equal(gamma(tests[2]),results[2],"<code>gamma("+tests[2]+")</code> should return <code>"+results[2]+"</code>.")'
  - text: '<code>gamma(&quot;+tests[3]+&quot;)</code> deve retornar <code>&quot;+results[3]+&quot;</code> .'
    testString: 'assert.equal(gamma(tests[3]),results[3],"<code>gamma("+tests[3]+")</code> should return <code>"+results[3]+"</code>.")'
  - text: '<code>gamma(&quot;+tests[4]+&quot;)</code> deve retornar <code>&quot;+results[4]+&quot;</code> .'
    testString: 'assert.equal(gamma(tests[4]),results[4],"<code>gamma("+tests[4]+")</code> should return <code>"+results[4]+"</code>.")'

Challenge Seed

function gamma (x) {
  // Good luck!
}

After Test

console.info('after the test');

Solution

// solution required