An open API service indexing awesome lists of open source software.

https://github.com/rabestro/interview-algorithms-kolin-task-01

small task for the interview
https://github.com/rabestro/interview-algorithms-kolin-task-01

Last synced: 10 months ago
JSON representation

small task for the interview

Awesome Lists containing this project

README

          

# The smallest value

A user inputs a `long` positive number *m*. You need to find out what is the smallest int number *n* such that *n! > m*.

**n!**, or factorial n, is a product of all natural numbers from 1 to n inclusive: for example, 5! = 1 * 2 * 3 * 4 * 5.

Just in case: [wiki on factorials](https://en.wikipedia.org/wiki/Factorial).

For example, the user enters 100. This means m = 100 and n = 5 because 5! = 120 (see the factorial formula) and this is the smallest number that satisfies the condition n! > m.

Pay attention that the user may input a really big number so choose an appropriate data type!