32
2
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):
If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!\$ constitute the integer \$A\$.
Challenge
Your challenge is given some \$A \geqslant 1\$ find a corresponding \$N \geqslant 1\$.
Details
- \$N!\$ represents the factorial \$N! = 1\cdot 2 \cdot 3\cdot \ldots \cdot N\$ of \$N\$.
- The digits of \$A\$ in our case are understood to be in base \$10\$.
- Your submission should work for arbitrary \$A\geqslant 1\$ given enough time and memory. Just using e.g. 32-bit types to represent integers is not sufficient.
- You don't necessarily need to output the least possible \$N\$.
Examples
A N
1 1
2 2
3 9
4 8
5 7
6 3
7 6
9 96
12 5
16 89
17 69
18 76
19 63
24 4
72 6
841 12745
206591378 314
The least possible \$N\$ for each \$A\$ can be found in https://oeis.org/A076219
26I... why did he prove that theorem? Did he just wake up one day and say "I shall solve this!" or did it serve a purpose? – Magic Octopus Urn – 2019-04-25T19:53:39.467
11@MagicOctopusUrn Never dealt with a number theorist before, have you? – Brady Gilg – 2019-04-26T16:16:17.417
2Here's the proof it anyone's interested. – Esolanging Fruit – 2019-04-29T02:39:19.087