#JavaScript (ES6), 60 bytes
Returns [numerator, denominator].
f=(n,a=0,b=1)=>n?f(n-1,p=a*n+b,q=b*n):b?f(0,b,a%b):[p/a,q/a]
###How?
The method is similar to @ChasBrown's Python answer .
We first compute the unreduced numerator \$a\$ and unreduced denominator \$b\$ by starting with \$a=0\$ and \$b=1\$ and recursively doing:
$$a\gets an+b\\ b\gets bn\\ n\gets n-1$$
until \$n=0\$.
We save \$(a,b)\$ into \$(p,q)\$ and then compute \$a\gets \gcd(a,b)\$ with:
$$a\gets b\\ b\gets a \bmod b$$
until \$b=0\$.
We finally return the reduced numerator \$p/a\$ and reduced denominator \$q/a\$.
#JavaScript (ES6), 60 bytes
Returns [numerator, denominator].
f=(n,a=0,b=1)=>n?f(n-1,p=a*n+b,q=b*n):b?f(0,b,a%b):[p/a,q/a]
#JavaScript (ES6), 60 bytes
Returns [numerator, denominator].
f=(n,a=0,b=1)=>n?f(n-1,p=a*n+b,q=b*n):b?f(0,b,a%b):[p/a,q/a]
###How?
The method is similar to @ChasBrown's Python answer .
We first compute the unreduced numerator \$a\$ and unreduced denominator \$b\$ by starting with \$a=0\$ and \$b=1\$ and recursively doing:
$$a\gets an+b\\ b\gets bn\\ n\gets n-1$$
until \$n=0\$.
We save \$(a,b)\$ into \$(p,q)\$ and then compute \$a\gets \gcd(a,b)\$ with:
$$a\gets b\\ b\gets a \bmod b$$
until \$b=0\$.
We finally return the reduced numerator \$p/a\$ and reduced denominator \$q/a\$.
#JavaScript (ES6), 60 bytes
Returns [numerator, denominator].
f=(n,a=0,b=1)=>n?f(n-1,p=a*n+b,q=b*n):b?f(0,b,a%b):[p/a,q/a]