Difference between revisions of "2017 AMC 12A Problems/Problem 7"

(Solution)
(Added another video solution)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
==Problem==
 
==Problem==
  
Define a function on the positive integers recursively by <math>f(1) = 2</math>, <math>f(n) = f(n-1) + 2</math> if <math>n</math> is even, and <math>f(n) = f(n-2) + 2</math> if <math>n</math> is odd and greater than <math>1</math>. What is <math>f(2017)</math>?
+
Define a function on the positive integers recursively by <math>f(1) = 2</math>, <math>f(n) = f(n-1) + 1</math> if <math>n</math> is even, and <math>f(n) = f(n-2) + 2</math> if <math>n</math> is odd and greater than <math>1</math>. What is <math>f(2017)</math>?
  
 
<math> \textbf{(A)}\ 2017 \qquad\textbf{(B)}\ 2018 \qquad\textbf{(C)}\ 4034 \qquad\textbf{(D)}\ 4035 \qquad\textbf{(E)}\ 4036 </math>
 
<math> \textbf{(A)}\ 2017 \qquad\textbf{(B)}\ 2018 \qquad\textbf{(C)}\ 4034 \qquad\textbf{(D)}\ 4035 \qquad\textbf{(E)}\ 4036 </math>
 
==Solution==
 
==Solution==
This is a recursive function, which means the function is used to evaluate itself. To solve this, we must identify the base case, <math>f(1)=2</math>. We also know that when <math>n</math> is odd, <math>f(n)=f(n-2)+2</math>. Thus we know that <math>f(2017)=f(2015)+2</math>. Thus we know that n will always be odd in the recursion of <math>f(2017)</math>, and we add two each recursive cycle, which there are <math>1008</math> of. Thus the answer is <math>1008*2+2=2018</math>.
+
This is a recursive function, which means the function refers back to itself to calculate subsequent terms. To solve this, we must identify the base case, <math>f(1)=2</math>. We also know that when <math>n</math> is odd, <math>f(n)=f(n-2)+2</math>. Thus we know that <math>f(2017)=f(2015)+2</math>. Thus we know that n will always be odd in the recursion of <math>f(2017)</math>, and we add <math>2</math> each recursive cycle, which there are <math>1008</math> of. Thus the answer is <math>1008*2+2=2018</math>, which is answer
<math>\boxed{\textbf{(B)}}</math>
+
<math>\boxed{\textbf{(B)}}</math>.
 +
Note that when you write out a few numbers, you find that <math>f(n)=n+1</math> for any <math>n</math>, so <math>f(2017)=2018</math>
  
Alternatively, simply download java and run this method:
+
==Video Solution (HOW TO THINK CREATIVELY!!!)==
 +
https://youtu.be/ZxcTc-3FoiU
  
 +
~Education, the Study of Everything
  
    public static int f(int n){
+
==Video Solution==
        if(n == 1)
+
https://www.youtube.com/watch?v=Vaauk0gNy_k
            return 2;
+
 
        else if(n % 2 == 0)
+
~Math4All999
            return f(n-1) + 2;
 
        else
 
            return f(n-2) + 2;
 
    }
 
  
 
==See Also==
 
==See Also==
 
{{AMC12 box|year=2017|ab=A|num-b=6|num-a=8}}
 
{{AMC12 box|year=2017|ab=A|num-b=6|num-a=8}}

Latest revision as of 06:23, 14 September 2024

Problem

Define a function on the positive integers recursively by $f(1) = 2$, $f(n) = f(n-1) + 1$ if $n$ is even, and $f(n) = f(n-2) + 2$ if $n$ is odd and greater than $1$. What is $f(2017)$?

$\textbf{(A)}\ 2017 \qquad\textbf{(B)}\ 2018 \qquad\textbf{(C)}\ 4034 \qquad\textbf{(D)}\ 4035 \qquad\textbf{(E)}\ 4036$

Solution

This is a recursive function, which means the function refers back to itself to calculate subsequent terms. To solve this, we must identify the base case, $f(1)=2$. We also know that when $n$ is odd, $f(n)=f(n-2)+2$. Thus we know that $f(2017)=f(2015)+2$. Thus we know that n will always be odd in the recursion of $f(2017)$, and we add $2$ each recursive cycle, which there are $1008$ of. Thus the answer is $1008*2+2=2018$, which is answer $\boxed{\textbf{(B)}}$. Note that when you write out a few numbers, you find that $f(n)=n+1$ for any $n$, so $f(2017)=2018$

Video Solution (HOW TO THINK CREATIVELY!!!)

https://youtu.be/ZxcTc-3FoiU

~Education, the Study of Everything

Video Solution

https://www.youtube.com/watch?v=Vaauk0gNy_k

~Math4All999

See Also

2017 AMC 12A (ProblemsAnswer KeyResources)
Preceded by
Problem 6
Followed by
Problem 8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
All AMC 12 Problems and Solutions