# Ruby - <del>160</del> <del>152</del> 140 Chars Using recursion and the fact that for this recursive function, cos(x, n) = 1 + sin(x, n + 1) <!-- language-all: lang-rb --> p=->x,n{n<1?1:x*p[x,n-1]} f=->n{n<2?1:n*f[n-1]} c=->x,n{n<1?1:p[x,n]/f[n]-c[x,n-2]} x,n=gets.split.map &:to_f n*=2 puts c[x,n-1]+1,c[x,n-2] Edit: Contributed by commenters (read below).