login
Initially there are n people in a room. At each step, if there are currently M people in the room, [M/k^2] of them leave, for k = 2, 3, ... Sequence gives number who are left at the end.
4

%I #13 Feb 10 2018 06:41:15

%S 1,2,3,3,4,5,6,6,7,8,8,8,9,10,11,11,12,13,14,14,15,15,15,15,16,17,18,

%T 18,19,20,21,21,22,23,23,23,24,24,25,25,26,27,28,28,29,29,29,29,30,31,

%U 32,32,33,34,35,35,35,36,36,36,37,38,39,39,40,41,42,42,43,43,43,43,44,45,46,46

%N Initially there are n people in a room. At each step, if there are currently M people in the room, [M/k^2] of them leave, for k = 2, 3, ... Sequence gives number who are left at the end.

%C If [M/k^2] is changed to [M/k] we get A100617.

%H Reinhard Zumkeller, <a href="/A100618/b100618.txt">Table of n, a(n) for n = 1..10000</a>

%e 10 -> 10 - [10/4] = 8 -> 8 - [8/9] = 8, which is now fixed, so a(10) = 8.

%p f:=proc(n) local i,j,k; k:=n; for i from 2 to 10000 do j := floor(k/(i^2)); if j < 1 then break; fi; k := k-j; od; k; end;

%t a[n_] := (k = 2; FixedPoint[# - Floor[#/(k++)^2]&, n]); Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Feb 10 2018 *)

%o (Haskell)

%o a100618 n = f 2 n where

%o f k n | n' == 0 = n

%o | otherwise = f (k+1) (n-n') where n' = div n (k^2)

%o -- _Reinhard Zumkeller_, Sep 15 2011

%Y Cf. A250007 (run lengths).

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Dec 03 2004