4 kyu

Large Factorials

3,004 of 9,477matt c

Description:

In mathematics, the factorial of integer n is written as n!. It is equal to the product of n and every integer preceding it. For example: 5! = 1 x 2 x 3 x 4 x 5 = 120

Your mission is simple: write a function that takes an integer n and returns the value of n!.

You are guaranteed an integer argument. For any values outside the non-negative range, return null, nil or None (return an empty string "" in C and C++). For non-negative numbers a full length number is expected for example, return 25! = "15511210043330985984000000" as a string.

For more on factorials, see http://en.wikipedia.org/wiki/Factorial

NOTES:

  • The use of BigInteger or BigNumber functions has been disabled, this requires a complex solution

  • I have removed the use of require in the javascript language.

Algorithms
Big Integers

Stats:

CreatedJun 15, 2015
PublishedJun 19, 2015
Warriors Trained29863
Total Skips7553
Total Code Submissions99776
Total Times Completed9477
JavaScript Completions3004
C# Completions1079
C++ Completions1734
Java Completions3034
C Completions681
NASM Completions5
Rust Completions104
Total Stars918
% of votes with a positive feedback rating87% of 1259
Total "Very Satisfied" Votes985
Total "Somewhat Satisfied" Votes216
Total "Not Satisfied" Votes58
Ad
Contributors
  • matt c Avatar
  • smile67 Avatar
  • donaldsebleung Avatar
  • kazk Avatar
  • user5036852 Avatar
  • user4912975 Avatar
  • mtvoodoo Avatar
  • nomennescio Avatar
  • Voile Avatar
  • henrywoody Avatar
  • monadius Avatar
  • Awesome A.D. Avatar
  • hobovsky Avatar
  • Kacarott Avatar
  • Yato333 Avatar
Ad