Bunuel
f(n) and g(n) are defined as follows:
f(n) = {0 if n is even 1 if n is odd} and g(n) = {0 if n is a multiple of 5 1 if n is not a multiple of 5}
If h(n) is defined as (1 + f(n))(1 - g(n)), what is h(1) + h(2) + ... + h(1900)?
A. 550
B. 560
C. 570
D. 580
E. 590
\[ f(n) =
\begin{cases}
0 & \quad \text{if } n \text{ is even}\\
1 & \quad \text{if } n \text{ is odd}
\end{cases}
\]
\[ g(n) =
\begin{cases}
0 & \quad \text{if } n \text{ is a multiple of 5}\\
1 & \quad \text{if } n \text{ is not a multiple of 5}
\end{cases}
\]
\(\\
h(n) = (1 + f(n))*(1 - g(n))\)
We can have four cases
1. n is even & a multiple of 5
\(h(n) = (1 + f(n))*(1 - g(n)) = (1+0)(1-0) = 1\)2. n is even & not a multiple of 5
\(h(n) = (1 + f(n))*(1 - g(n)) = (1+0)(1-1) = 0\)3. n is odd & a multiple of 5
\(h(n) = (1 + f(n))*(1 - g(n)) = (1+1)(1-0) = 2\)5. n is odd & not a multiple of 5
\(h(n) = (1 + f(n))*(1 - g(n)) = (1+1)(1-1) = 0\)After, solving for each of these cases we can summarize h(n) as -
\[ h(n) =
\begin{cases}
1 & \quad \text{if } n \text{ is an even multiple of 5}\\
2 & \quad \text{if } n \text{ is an odd multiple of 5}\\
0 & \quad \text{if } n \text{ is any other value}
\end{cases}
\]
Between 1 and 1900, the number of multiple of 5 =
\(\frac{1900 - 5 }{ 5} + 1\) = 380
Out of these 380, 190 are even multiples and 190 are odd multiples.
Sum = (190*2) + 190 = 380 + 190 = 570
Option C