A018799 Smallest nonnegative integer m such that m! begins with n in base 10.
0, 2, 9, 8, 7, 3, 6, 14, 96, 27, 22, 5, 15, 42, 25, 89, 69, 76, 63, 16, 87, 113, 54, 4, 23, 30, 205, 85, 34, 28, 62, 164, 41, 245, 17, 9, 36, 128, 11, 8, 185, 53, 351, 73, 369, 118, 12, 265, 129, 7, 21, 38, 235, 66, 46, 258, 81, 597, 279, 43, 72, 13, 559, 18, 203, 120, 311
Offset: 1
Examples
Since no factorial below 96! ~ 9.91*10^149 starts with 9, we have a(9) = 96. Similarly, 16 first appears as the leading digits of 89! ~ 1.65*10^136 and hence a(16) = 89. - _Lekraj Beedassy_, Oct 31 2010 and _Robert G. Wilson v_, Nov 05 2010
Links
- Jon E. Schoenfield, Table of n, a(n) for n = 1..10000 (terms 1..1000 from David W. Wilson).
- John E. Maxfield, A Note on N!, Mathematics Magazine, Vol. 43. No. 2 (1970), pp. 64-67.
- Laura Southard, Investigations on Maxfield's Theorem, Pi Mu Epsilon Journal, Vol. 7, No. 8 (1983), pp. 493-495, alternative link.
Crossrefs
Programs
-
Mathematica
f[n_] := Block[{k = 0, m}, While[ m = Max[0, Floor@ Log[10, k! ] - Floor@ Log[10, n]]; (k! - Mod[k!, 10^m])/10^m != n, k++ ]; k]; Array[f, 67] (* Robert G. Wilson v, Nov 05 2010 *)
-
PARI
A018799(n)={ local( F=1,k=0 ); while( F\1!=n, F*=k++; while( F>=n+1, F/=10)); k} \\ M. F. Hasler, Feb 01 2009
Comments