cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A197423 Smallest integer m such that !m begins with n in base 10.

This page as a plain text file.
%I A197423 #13 Feb 02 2017 18:59:11
%S A197423 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,
%T A197423 138,6,156,186,52,31,33,14,166,98,97,96,104,35,105,27,22,93,146,5,48,
%U A197423 55,249,15,91,37,42,187,77,90,124,352,25,110,394,89,280,69,147
%N A197423 Smallest integer m such that !m begins with n in base 10.
%C A197423 !n is a subfactorial number (A000166).
%e A197423 Subfactorial(0) = 1 begins with 1, so a(1) = 0 ;
%e A197423 Subfactorial(3) = 2 begins with 2, so a(2) = 3 ;
%e A197423 Subfactorial(14) = 32071101049 begins with 3, so a(3) = 14.
%p A197423 for n from 1 to 100 do:l1:=length(n):i:=0:for m from 1 to 400 while(i=0)do:
%p A197423 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:
%t A197423 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 *)
%Y A197423 Cf. A000166, A018799.
%K A197423 nonn,base
%O A197423 0,3
%A A197423 _Michel Lagneau_, Oct 14 2011
%E A197423 a(0)=1 prepended by _Alois P. Heinz_, Feb 02 2017