|
|
A197423
|
|
Smallest integer m such that !m begins with n in base 10.
|
|
0
|
|
|
1, 0, 3, 14, 5, 25, 69, 16, 20, 4, 34, 28, 41, 9, 8, 53, 73, 12, 7, 38, 46, 81, 13, 18, 120, 138, 6, 156, 186, 52, 31, 33, 14, 166, 98, 97, 96, 104, 35, 105, 27, 22, 93, 146, 5, 48, 55, 249, 15, 91, 37, 42, 187, 77, 90, 124, 352, 25, 110, 394, 89, 280, 69, 147
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
!n is a subfactorial number (A000166).
|
|
LINKS
|
|
|
EXAMPLE
|
Subfactorial(0) = 1 begins with 1, so a(1) = 0 ;
Subfactorial(3) = 2 begins with 2, so a(2) = 3 ;
Subfactorial(14) = 32071101049 begins with 3, so a(3) = 14.
|
|
MAPLE
|
for n from 1 to 100 do:l1:=length(n):i:=0:for m from 1 to 400 while(i=0)do:
s:=0:for j from 0 to m do: s:=s+m!*(((-1)^j)*1/j!) :od:x:=s:l:=length(x):y:=floor(x/(10^(l-l1))):if y=n and l>=l1 then i:=1: printf ( "%d %d \n", n, m): else fi:od:od:
|
|
MATHEMATICA
|
f[n_] := Block[{k = 0, m}, While[m = Max[0, Floor@Log[10, Subfactorial[k]] - Floor@Log[10, n]]; (Subfactorial[k] - Mod[Subfactorial[k], 10^m])/10^m! = n, k++]; k]; Array[f, 67] (* program from David W. Wilson - see A018799 Nov 05 2010 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|