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
- Host: GitHub
- URL: https://github.com/rabestro/interview-algorithms-kolin-task-01
- Owner: rabestro
- Created: 2022-11-02T13:08:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-04T12:57:53.000Z (over 3 years ago)
- Last Synced: 2024-12-28T05:25:33.845Z (over 1 year ago)
- Language: Kotlin
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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!