login
Start with X = prime(n). Repeatedly replace X with X - ceiling(X/n); a(n) is the number of steps to reach a number <= ceiling(n*log(n)).
1

%I #16 Mar 31 2017 02:56:23

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

%T 5,6,6,6,6,6,6,7,6,6,5,7,8,8,7,7,7,6,7,8,8,8,7,8,7,7,8,9,9,9,8,10,10,

%U 11,11,10,11,11,11,11,11,11,11,11,12,12,12,13,12,12,12,12,12,12,11,11,12,13,12,13,12,13,13,13,15,15,16,16,16,15,15,16,16,16,15,15,15,15,14,15,16,15,15,15,15,14,15,15,15,16,16,16,17,18

%N Start with X = prime(n). Repeatedly replace X with X - ceiling(X/n); a(n) is the number of steps to reach a number <= ceiling(n*log(n)).

%C The sequence is based on the well known Rosser's inequality, prime(n) >= ceiling(n*log(n)), n >= 2, and the Een Eigen Rij algorithm (cf. A278586).

%H Charles R Greathouse IV, <a href="/A278950/b278950.txt">Table of n, a(n) for n = 2..10000</a>

%t f[n_] := Length@ NestWhileList[# - Ceiling[#/n] &, Prime@ n, # > Ceiling[n*Log[ n]] &] - 1; Array[f, 80, 2] (* _Robert G. Wilson v_, Dec 02 2016 *)

%o (PARI) a(n,x=prime(n))=my(t=ceil(log(n)*n),s); while(x>t, x -= (x-1)\n + 1; s++); s \\ _Charles R Greathouse IV_, Dec 02 2016

%Y Cf. A000040, A278586.

%K nonn

%O 2,9

%A _Vladimir Shevelev_, Dec 02 2016

%E More terms from _Peter J. C. Moses_, Dec 02 2016