%I #2 Mar 30 2012 17:30:31
%S 1,2,3,4,5,9,14,23,28,51,74,125,153,181,306,380,686,839,992,1372,1678,
%T 2517,3203,4042,5720,7092,8464,10142,12659,18379,24099,28141,35233,
%U 39275,51934,64593,77252,89911,100053,139328,174561,209794,237935
%N a(n) = a(n-1) + a(n - 1 minus the number of terms of a(k) == (mod 5) so far).
%t m[ 1 ] = 1; m[ 2 ] = 2; m[ 3 ] = 3; a[ 4 ] = 4; m[ 5 ] = 5; m[ n_Integer ] := m[ n ] = Block[ {a = b = c = d = 0}, Do[ Switch[ Mod[ m[ k ], 5 ], 0, a++, 1, b++, 2, c++, 3, d++, 4, e++ ], {k, 1, n - 1} ]; Switch[ Mod[ n, 5 ], 0, m[ n - 1 ] + m[ n - 1 - a ], 1, m[ n - 1 ] + m[ n - 1 - b ], 2, m[ n - 1 ] + m[ n - 1 - c ], 3, m[ n - 1 ] + m[ n - 1 - d ], 4, m[ n - 1 ] + m[ n - 1 - e ] ] ]; Table[ m[ n ], {n, 1, 50} ]
%K nonn
%O 1,2
%A _Robert G. Wilson v_, Apr 22 2001