login
a(n) is the smallest positive m such that n <= m!.
9

%I #20 Apr 06 2022 06:04:25

%S 1,1,2,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,

%T 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,

%U 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5

%N a(n) is the smallest positive m such that n <= m!.

%C Define f(n,k) = floor[n/k]. Let f(n,2)= n_2, f(n_2,3) = n_3, ..., f(n_r, r+1) = n_(r+1). a(n) = least value of r such that n_r = 0. E.g., a(10) = 4, 10 -> 10/1 -> 10 -> 10/2 -> 5 -> 5/3 -> 1 -> 1/4 -> 0 in four steps.

%H Reinhard Zumkeller, <a href="/A090529/b090529.txt">Table of n, a(n) for n = 0..10000</a>,

%H Yi Yuan and Zhang Wenpeng, <a href="http://www.gallup.unm.edu/~smarandache/S-analogue-f.pdf">On the Mean Value of the Analogue of Smarandache Function</a>.

%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>

%F a(n+1) = A084558(n) + 1. - _Reinhard Zumkeller_, Jan 05 2014

%e a(4)=3 because 2! < 4 <= 3!;

%e a(24)=4 because 3! < 24 <= 4!.

%p A090529 := proc(n)

%p local a;

%p for a from 1 do

%p if a! >= n then

%p return a;

%p end if;

%p end do:

%p end proc:

%p seq(A090529(n),n=0..100) ; # _R. J. Mathar_, Apr 06 2022

%t Array[Block[{m = 1}, While[# > m!, m++]; m] &, 105, 0] (* _Michael De Vlieger_, Nov 18 2017 *)

%t With[{f=Table[{m,m!},{m,10}]},Table[Select[f,#[[2]]>=n&][[1]],{n,0,110}]][[All,1]] (* _Harvey P. Dale_, Jan 01 2020 *)

%o (PARI) a(n)=if(n<0,0,p=1;while(p!<n,p++);p)

%o (PARI) A090529(n)=for(m=1,n,m!<n || return(m)) \\ _M. F. Hasler_, Jan 16 2013

%o (Haskell)

%o a090529 n = a090529_list !! n

%o a090529_list = f 1 1 0 where

%o f w v u = if u <= w then v : f w v (u+1) else v' : f (w*v') v' (u+1)

%o where v' = v + 1

%o -- _Reinhard Zumkeller_, Jan 05 2014

%Y Cf. A084558, A000142.

%K nonn

%O 0,3

%A _Amarnath Murthy_, Dec 07 2003

%E Better description and more terms from Zhang Wenpeng (wpzhang(AT)nwu.edu.cn), Mar 29 2004