OFFSET
1,2
EXAMPLE
a(5) = a(4) + a(4 - the number of terms congruent to 1 (mod 4) so far) = a(4) + a(4-1) = 4 + 3 = 7.
MATHEMATICA
m[ 1 ] = 1; m[ 2 ] = 2; m[ 3 ] = 3; a[ 4 ] = 4; m[ n_Integer ] := m[ n ] = Block[ {a = b = c = d = 0}, Do[ Switch[ Mod[ m[ k ], 4 ], 0, a++, 1, b++, 2, c++, 3, d++ ], {k, 1, n - 1} ]; Switch[ Mod[ n, 4 ], 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 ] ] ]; Table[ m[ n ], {n, 1, 50} ]
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Apr 22 2001
STATUS
approved