%I #40 Dec 18 2018 18:43:32
%S 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,
%T 30,205,85,34,28,62,164,41,245,17,9,36,128,11,8,185,53,351,73,369,118,
%U 12,265,129,7,21,38,235,66,46,258,81,597,279,43,72,13,559,18,203,120,311
%N Smallest nonnegative integer m such that m! begins with n in base 10.
%C Record high values are m = 0, 2, 9, 14, 96, 113, 205, 245, 351, 369, 597, ... (see A279089); these occur, respectively, at n = 1, 2, 3, 8, 9, 22, 27, 34, 43, 45, 58, ... (see A279090). - _Jon E. Schoenfield_, Jan 30 2017
%C The existence of such m for each n was proven by Maxfield in 1970. The first 999 terms of this sequence were calculated by Southard in 1983. - _Amiram Eldar_, Dec 18 2018
%H Jon E. Schoenfield, <a href="/A018799/b018799.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from David W. Wilson).
%H John E. Maxfield, <a href="https://www.jstor.org/stable/2688966">A Note on N!</a>, Mathematics Magazine, Vol. 43. No. 2 (1970), pp. 64-67.
%H Laura Southard, <a href="http://www.jstor.org/stable/24337804">Investigations on Maxfield's Theorem</a>, Pi Mu Epsilon Journal, Vol. 7, No. 8 (1983), pp. 493-495, <a href="http://www.pme-math.org/journal/issues/PMEJ.Vol.7.No.8.pdf">alternative link</a>.
%e 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
%t 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 *)
%o (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
%Y Cf. A018854.
%Y Apart from leading term, identical to A076219.
%Y Cf. A000142, A008905, A279089, A279090.
%K nonn,base
%O 1,2
%A _David W. Wilson_
|