login
a(0) = 0, a(n+1) = n + a(n)/(2 - a(n) mod 2).
3

%I #20 Feb 02 2018 14:35:25

%S 0,1,3,6,7,12,12,13,21,30,25,36,30,28,28,29,45,62,49,68,54,48,46,46,

%T 47,72,62,58,57,86,73,104,84,75,109,144,108,91,129,168,124,103,145,

%U 188,138,114,103,150,123,172,136,119,171,224,166,138,125,182,149,208,164,143

%N a(0) = 0, a(n+1) = n + a(n)/(2 - a(n) mod 2).

%C A138038 and A138039 respectively give record values and where they occur.

%H R. Zumkeller, <a href="/A138037/b138037.txt">Table of n, a(n) for n = 0..1000</a>

%p a[0]:= 0:

%p for n from 0 to 100 do a[n+1] := n + a[n]/(2 - (a[n] mod 2)) od:

%p seq(a[n],n=0..101); # _Robert Israel_, Jan 12 2016

%t a[0] = 0; a[n_] := n - 1 + a[n - 1]/(2 - Mod[a[n - 1], 2]); Table[a@ n, {n, 20}] (* _Michael De Vlieger_, Jan 12 2016 *)

%t nxt[{n_,a_}]:={n+1,n+1+a/(2-Mod[a,2] )}; NestList[nxt,{0,0},70][[All,2]] (* _Harvey P. Dale_, Sep 28 2016 *)

%K nonn

%O 0,3

%A _Reinhard Zumkeller_, Mar 02 2008