# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a249039 Showing 1-1 of 1 %I A249039 #10 Nov 11 2014 10:57:40 %S A249039 1,2,4,7,11,17,26,37,52,70,92,120,157,200,254,323,401,490,597,719,859, %T A249039 1021,1211,1438,1687,1979,2325,2740,3183,3704,4262,4863,5553,6350, %U A249039 7201,8174,9216,10336,11545,12894,14350,15928,17646,19526,21596,23893,26352,29060,32060,35406,39167 %N A249039 a(1)=1, a(2)=2; thereafter a(n) = a(n-1) + a(n-1-(number of even terms so far)) + a(n-1-(number of odd terms so far)). %C A249039 Suggested by A006336, A007604 and A249036-A249038. %H A249039 Reinhard Zumkeller, Table of n, a(n) for n = 1..10000 %F A249039 For n > 1: a(n+1) = a(n) + a(n - A249040(n)) + a(n - A249041(n)) by mutual recursion. - _Reinhard Zumkeller_, Nov 11 2014 %p A249039 M:=100; %p A249039 v[1]:=1; v[2]:=2; w[1]:=0; w[2]:=1; x[1]:=1; x[2]:=1; %p A249039 for n from 3 to M do %p A249039 v[n]:=v[n-1]+v[n-1-w[n-1]]+v[n-1-x[n-1]]; %p A249039 if v[n] mod 2 = 0 then w[n]:=w[n-1]+1; x[n]:=x[n-1]; %p A249039 else w[n]:=w[n-1]; x[n]:=x[n-1]+1; fi; %p A249039 od: %p A249039 [seq(v[n], n=1..M)]; # A249039 %p A249039 [seq(w[n], n=1..M)]; # A249040 %p A249039 [seq(x[n], n=1..M)]; # A249041 %o A249039 (Haskell) %o A249039 import Data.List (genericIndex) %o A249039 a249039 n = genericIndex a249039_list (n - 1) %o A249039 a249039_list = 1 : 2 : f 2 2 1 1 where %o A249039 f x u v w = y : f (x + 1) y (v + 1 - mod y 2) (w + mod y 2) %o A249039 where y = u + a249039 (x - v) + a249039 (x - w) %o A249039 -- _Reinhard Zumkeller_, Nov 11 2014 %Y A249039 Cf. A006336, A007604, A249036, A249037, A249038. %Y A249039 A249040 and A249041 give numbers of even and odd terms so far. %K A249039 nonn %O A249039 1,2 %A A249039 _N. J. A. Sloane_, Oct 26 2014 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE