diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 09:56:43 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 09:56:43 +0700 |
commit | 2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 (patch) | |
tree | 95190a32ec1c7098494849eea5a5ba6b53289585 /daily/286easy/problem.md | |
parent | 207cc2ae9893b0cdecd20119b9ede37f73cd4a1e (diff) | |
download | cp-2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0.tar.gz |
Initial commit
Diffstat (limited to 'daily/286easy/problem.md')
-rw-r--r-- | daily/286easy/problem.md | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/daily/286easy/problem.md b/daily/286easy/problem.md new file mode 100644 index 0000000..8715cbe --- /dev/null +++ b/daily/286easy/problem.md @@ -0,0 +1,41 @@ +# Description + +Nearly everyone is familiar with the factorial operator in math. 5! yields 120 because factorial means "multiply successive terms where each are one less than the previous": + + 5! -> 5 * 4 * 3 * 2 * 1 -> 120 + +Simple enough. + +Now let's reverse it. Could you write a function that tells us that "120" is "5!"? + +Hint: The strategy is pretty straightforward, just divide the term by successively larger terms until you get to "1" as the resultant: + + 120 -> 120/2 -> 60/3 -> 20/4 -> 5/5 -> 1 => 5! + +# Sample Input + +You'll be given a single integer, one per line. Examples: + + 120 + 150 + +# Sample Output + +Your program should report what each number is as a factorial, or "NONE" if it's not legitimately a factorial. Examples: + + 120 = 5! + 150 NONE + +# Challenge Input + + 3628800 + 479001600 + 6 + 18 + +# Challenge Output + + 3628800 = 10! + 479001600 = 12! + 6 = 3! + 18 NONE |