[Question]
  [
# The plus-minus sequence
The plus-minus sequence is one that starts with two seeds, `a(0)` and `b(0)`. Each iteration of this sequence is the addition and subtraction of the previous two members of the sequence. That is, `a(N) = a(N-1) + b(N-1)` and `b(N) = a(N-1) - b(N-1)`.
**Objective** Produce the plus-minus sequence, in infinitude or the first `K` steps given `K`. You may do this using an infinite output program, a generator, or a function/program that gives the first `K` steps. The output order does not matter, so long as it is consistent. (I.e., `b(K) a(K)` or `a(K) b(K)`, with some non-numeric, non-newline separator in between.) The output must start with the input.
## Test cases
For inputs `10 2` (of `a(0) b(0)`, this is a possible output for the first K approach (or a subsection of the infinite approach):
```
10     2
12     8
20     4
24     16
40     8
48     32
80     16
96     64
160    32
192    128
320    64
384    256
640    128
768    512
1280   256
1536   1024
2560   512
3072   2048
5120   1024
6144   4096
10240  2048
12288  8192
20480  4096
24576  16384
40960  8192
49152  32768
81920  16384
98304  65536
```
For inputs `2 20 10` (`a(0) b(0) k`):
```
2     20
22   -18
4     40
44   -36
8     80
88   -72
16    160
176  -144
32    320
352  -288
```
---
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest program in bytes wins.
### Catalog
The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
```
## Language Name, N bytes
```
where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:
```
## Ruby, <s>104</s> <s>101</s> 96 bytes
```
If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:
```
## Perl, 43 + 2 (-p flag) = 45 bytes
```
You can also make the language name a link which will then show up in the snippet:
```
## [><>](http://esolangs.org/wiki/Fish), 121 bytes
```
```
<style>body { text-align: left !important} #answer-list { padding: 10px; width: 290px; float: left; } #language-list { padding: 10px; width: 290px; float: left; } table thead { font-weight: bold; } table td { padding: 5px; }</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table><script>var QUESTION_ID = 76983; var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk"; var OVERRIDE_USER = 12012; var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page; function answersUrl(index) { return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER; } function commentUrl(index, answers) { return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER; } function getAnswers() { jQuery.ajax({ url: answersUrl(answer_page++), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { answers.push.apply(answers, data.items); answers_hash = []; answer_ids = []; data.items.forEach(function(a) { a.comments = []; var id = +a.share_link.match(/\d+/); answer_ids.push(id); answers_hash[id] = a; }); if (!data.has_more) more_answers = false; comment_page = 1; getComments(); } }); } function getComments() { jQuery.ajax({ url: commentUrl(comment_page++, answer_ids), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { data.items.forEach(function(c) { if (c.owner.user_id === OVERRIDE_USER) answers_hash[c.post_id].comments.push(c); }); if (data.has_more) getComments(); else if (more_answers) getAnswers(); else process(); } }); } getAnswers(); var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/; var OVERRIDE_REG = /^Override\s*header:\s*/i; function getAuthorName(a) { return a.owner.display_name; } function process() { var valid = []; answers.forEach(function(a) { var body = a.body; a.comments.forEach(function(c) { if(OVERRIDE_REG.test(c.body)) body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>'; }); var match = body.match(SCORE_REG); if (match) valid.push({ user: getAuthorName(a), size: +match[2], language: match[1], link: a.share_link, }); else console.log(body); }); valid.sort(function (a, b) { var aB = a.size, bB = b.size; return aB - bB }); var languages = {}; var place = 1; var lastSize = null; var lastPlace = 1; valid.forEach(function (a) { if (a.size != lastSize) lastPlace = place; lastSize = a.size; ++place; var answer = jQuery("#answer-template").html(); answer = answer.replace("{{PLACE}}", lastPlace + ".") .replace("{{NAME}}", a.user) .replace("{{LANGUAGE}}", a.language) .replace("{{SIZE}}", a.size) .replace("{{LINK}}", a.link); answer = jQuery(answer); jQuery("#answers").append(answer); var lang = a.language; lang = jQuery('<a>'+lang+'</a>').text(); languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang.toLowerCase(), user: a.user, size: a.size, link: a.link}; }); var langs = []; for (var lang in languages) if (languages.hasOwnProperty(lang)) langs.push(languages[lang]); langs.sort(function (a, b) { if (a.lang_raw > b.lang_raw) return 1; if (a.lang_raw < b.lang_raw) return -1; return 0; }); for (var i = 0; i < langs.length; ++i) { var language = jQuery("#language-template").html(); var lang = langs[i]; language = language.replace("{{LANGUAGE}}", lang.lang) .replace("{{NAME}}", lang.user) .replace("{{SIZE}}", lang.size) .replace("{{LINK}}", lang.link); language = jQuery(language); jQuery("#languages").append(language); } }</script>
```
  
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 5 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ṄI;Sß
```
This is a recursive approach. Due to tail call optimization, the only limit is the ability to fit both integers into memory. Output is one list per line.
[Try it online!](http://jelly.tryitonline.net/#code=4bmESTtTw58&input=&args=MiwgMTA)
### How it works
```
ṄI;Sß  Main link. Argument: [b[n], a[n]] (n = 0 for original input)
Ṅ      Print [b[n], a[n]] to STDOUT.
 I     Compute the increments of the list, i.e., [a[n] - [b[n]].
   S   Compute the sum of the list, i.e., b[n] + a[n].
  ;    Concatenate the results to the left and to the right.
    ß  Recursively call the main link.
```
[Answer]
## Haskell, 19 bytes
```
a#b=a:b:(a+b)#(a-b)
```
Produces an infinite sequence of numbers. Usage example:
```
Prelude> take 20 $ 2#20
[2,20,22,-18,4,40,44,-36,8,80,88,-72,16,160,176,-144,32,320,352,-288]
```
[Answer]
## Python 2, 31 bytes
```
def f(a,b):print a,b;f(a+b,a-b)
```
Prints forever. Well, eventually you exceed the recursion limit, but that's a system limitation.
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 10 bytes
```
`tDtswPdhT
```
This version will output an infinite number of elements in the plus-minus sequence.
[**Try it Online!**](http://matl.tryitonline.net/#code=YHREdHN3UGRoVA&input=WzEwLDJd)
(stop it after running due to infinite loop)
**Explanation**
```
    % Implicitly grab input as a two-element array [a,b]
`   % do...while loop
tD  % Duplicate and display the top of the stack
ts  % Duplicate [a,b] and add them together
w   % Swap the top two elements on the stack
P   % Swap the order of b and a in preparation for diff
d   % Compute the difference between b and a
h   % Horizontally concatenate [a+b, a-b]
T   % Explicit TRUE to make it an infinite loop
    % Implicit end of the do...while loop
```
[Answer]
# Julia, 25 bytes
```
a<|b=[a b]|>show<a+b<|a-b
```
Maximum syntax abuse. Julia is *weird*. [Try it online!](http://julia.tryitonline.net/#code=YTx8Yj1bYSBiXXw-c2hvdzxhK2I8fGEtYgoKMTA8fDI&input=)
### Alternate version, 29 bytes
Note that the output will eventually overflow unless you call `<|` on a *BigInt*. Unfortunately, `show` will prefix each array with `BigInt` in this case. At the cost of four more bytes, we can generated whitespace-separated output for all numeric types.
```
a<|b="$a $b
"|>print<a+b<|a-b
```
[Try it online!](http://julia.tryitonline.net/#code=YTx8Yj0iJGEgJGIKInw-cHJpbnQ8YStiPHxhLWIKCmJpZygxMCk8fDI&input=)
### How it works
We define the binary operator `<|` for out purposes. It is undefined in recent versions of Julia, but still recognized as an operator by the parser. While `\` (not explicitly defined for integers) is one byte shorter, its high precedence would require replacing `a+b<|a-b` with `(a+b)\(a-b)` (+3 bytes) or `\(a+b,a-b)` (+2 bytes).
When `a<|b` is executed, it starts by calling `show` to print **[a b]** to STDOUT. Then, `a+b<|a-b` recursively calls `<|` on the sum or the difference.
Since the recursion is (supposed to be) infinite, the comparison `<` is never performed; it sole purpose is chaining the two parts of the code. This saves two bytes over the more straightforward alternative `([a b]|>show;a+b<|a-b)`.
[Answer]
# Pyth, ~~10~~ 9 bytes
*Thanks to @isaacg for 1 byte.*
```
#=Q,s
Q-F
```
Prints an infinite sequence of pairs.
```
$ pyth plusminus.p <<< "[10,2]" | head -n 15
[10, 2]
[12, 8]
[20, 4]
[24, 16]
[40, 8]
[48, 32]
[80, 16]
[96, 64]
[160, 32]
[192, 128]
[320, 64]
[384, 256]
[640, 128]
[768, 512]
[1280, 256]
```
[Answer]
# C, 81 bytes
```
a,b;main(c){for(scanf("%d%d%d",&a,&b,&c);c--;a+=b,b=a-b-b)printf("%d %d\n",a,b);}
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 7 bytes
Uses the **first-k** method. Input in the following for:
```
k
[a, b]
```
Code:
```
FD=OsÆ‚
```
Explanation:
```
F        # For N in range(0, k).
 D=      # Duplicate top of the stack and print without popping.
   O     # Sum up the array.
    sÆ   # Swap and perform a reduced subtraction.
      ‚  # Pair the top two elements. a, b --> [a, b]
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=RkQ9T3PDhuKAmg&input=MjAKWzEwLCAyXQ)
[Answer]
# k, 12
```
{(+;-).\:x}\
```
.
```
k){(+;-).\:x}\[10;10 2]
10  2
12  8
20  4
24  16
40  8
48  32
80  16
96  64
160 32
192 128
320 64
```
Could also be called in the form of
```
k)10{(+;-).\:x}\10 2
```
[Answer]
## APL, 37 chars
```
{⍺←3⊃3↑⍵⋄⎕←z←2↑⍵⋄⍺=1:⋄(⍺-1)∇(+/,-/)z}
```
Can be used as 
```
    {⍺←3⊃3↑⍵⋄⎕←z←2↑⍵⋄⍺=1:⋄(⍺-1)∇(+/,-/)z} 10 2
10 2
12 8
20 4
24 16
40 8
48 32
80 16
[...]
```
or 
```
      {⍺←3⊃3↑⍵⋄⎕←z←2↑⍵⋄⍺=1:⋄(⍺-1)∇(+/,-/)z} 10 2 6
10 2
12 8
20 4
24 16
40 8
48 32
```
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf), 8 bytes
```
ô`αp‼+-∟
```
[Try it online!](https://tio.run/##y00syUjPz0n7///wloRzGwseNezR1n3UMf//fyMFQwMA "MathGolf – Try It Online")
Takes input in reverse order, but that's simply because that's how they are pushed onto the stack. Otherwise it'd be 1 byte longer. 2-3 bytes comes from the output. Without the need of actually printing one pair per line, the program could be `æ`‼+-∟` (fills the stack with the elements of the sequence indefinitely), or `É‼+-∟` (prints all elements of the sequence except the first one to debug, as long as `-d` flag is active).
## Explanation
```
ô      ∟   do-while-true
 `         duplicate the top two items
  αp       wrap last two elements in array and print
    ‼      apply next two operators to the top stack elements
     +     pop a, b : push(a+b)
      -    pop a, b : push(a-b)
```
[Answer]
# Python 3.5, 55 43 bytes:
```
def q(a,b):
 while 1:print(a,b);a,b=a+b,a-b
```
Prints out the correct sequence seemingly forever. I have been able to let this go on for about 30 minutes without any error being raised, and the program had printed out 2301 digits for the first number, and 1150 digits for the second! Based on this, I guessing that, being provided sufficient hardware to run on, this can go on for WAY longer and print out WAY more digits, and also has theoretically no recursion limit, courtesy of the `while` loop!
[Answer]
# Reng v.3.2, 9 bytes (self-answer, non-competing)
```
ii¤ææö±2.
```
Takes two inputs (`a b`) and outputs `b a`. [Try it here!](https://jsfiddle.net/Conor_OBrien/avnLdwtq/)
`i` takes input twice, `¤` duplicates the stack, `æ` prints a number and a space (and does so twice, there being two), `ö` prints a newline, `±` does what you might expect, and `2.` skips the next two characters, wrapping around the input getting characters.
[Answer]
## Python 2.7, ~~56~~, 42 bytes:
```
a,b=input()
while 1:print a,b;a,b=a+b,a-b
```
Simple loop that either prints forever(ish).
[Answer]
## Batch, 54 bytes
```
@echo %1 %2
@set/aa=%1+%2
@set/ab=%1-%2
@%0 %a% %b%
```
Note that CMD.EXE is limited to 32-bit signed integers, so it will quickly overflow and print garbage and error messages.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 23 bytes (infinite)
Edit: thanks to JoKing, the sequence version is now the shortest (also removed `.say` per clarification from OP:
```
{@_,{.sum,[-] |$_}...*}
```
[TIO:InfiniteSeq](https://tio.run/##K0gtyjH7n1upoJamYKvwv9ohXqdarzix0lqvuDRXJ1o3VqFGJb5WT09Pq/Y/UFghTcPQQMdIMzrO0CDW@j8A "Perl 6 – Try It Online")
Old functional answer
```
->\a,\b {(a,b).say;f(a+b,a -b)}
```
[TIO:InfiniteFunc](https://tio.run/##K0gtyjH7n1upoJamYPtf1y4mUScmSaFaI1EnSVOvOLHSOk0jUTtJJ1FBN0mz9r81F1eahqGBjpHmfwA "Perl 6 – Try It Online")
Note that Perl 6 has no per se recursion limit, it is purely based upon memory available, so this will reach the millions before bombing out.
[Answer]
# [Rust](https://www.rust-lang.org/), 78 bytes
```
|a,b,k|{let mut x=(a,b);for _ in 0..k{println!("{:?}",x);x=(x.0+x.1,x.0-x.1)}}
```
[Try it online!](https://tio.run/##HY3BCoMwEETvfsXWU5ZuQ/TYIH5KsWAgqNuSRgjEfHu6OpcHj2Em7L9YHcM2eVYIuQHJOkdwMEA9JnrTcuRTbHuENCgxaN0nwAs8g9F6yd/gOa58U21@jqWlhFaKSZt70h0JH0IspZ7b9npwqqfeUGfQNqX@AQ "Rust – Try It Online")
For fun, here's also an iterator that'll give you this sequence:
```
|a,b|(0..).scan((a,b),|x,_|{let i=*x;*x=(x.0+x.1,x.0-x.1);Some(i)})
```
[Answer]
# Factor, 62 bytes
```
:: f ( a b -- x ) a b "%s %s" printf a b + a b - f ; recursive
```
`recursive`, or else the callstack runs out too quickly.
[Answer]
# Ruby, 25 bytes
Based on [xnor's Python solution](https://codegolf.stackexchange.com/a/76988/47581). Perhaps I'll make a generator in another answer, but this will print `a`, then `b`, then the new `a`, then the new `b`, ad infinitum.
```
f=->a,b{p a,b;f[a+b,a-b]}
```
[Answer]
# Python 3, 42 bytes
I wanted to write a generator for this function, and so I did.
```
def f(a,b):
 while 1:yield a,b;a,b=a+b,a-b
```
In Python 3, the sequence is generated in this way:
```
>>> gen = f(2, 20)
>>> next(gen)
(2, 20)
>>> next(gen)
(22, -18)
>>> next(gen)
(4, 40)
>>> next(gen)
(44, -36)
>>> next(gen)
(8, 80)
```
[Answer]
## Common Lisp, 57
```
(lambda(a b)(loop(print`(,a,b))(psetf a(+ a b)b(- a b))))
```
Uses `psetf`, which affects values to variables in parallel, and the simple `loop` syntax.
[Answer]
# bash + GNU coreutils, 75 bytes
```
a=$1
b=$2
for i in `seq $3`;{ echo -e "$a\t$b";c=$a;a=$((c+b));b=$((c-b));}
```
Invocation:
```
./codegolf.sh 2 10 5
```
[Answer]
# CP/M 8080, 47 bytes
z80 mnemonics but nothing the 8080 doesn't have, source commented once I decided to count the output rather than the input but terse function names retained, hand assembled so forgive the 'xx's where I know the number of bytes but haven't worked out the output addresses or offsets:
```
# setup
ld c, 2     0e 02
# loop
.s
# update H (temporarily in B)
ld a, h     7c
add l       85
daa         27
ld b, a     46
# update L
ld a, h     7c
sub l       95
daa         27
ld l, a     6f
# copy B back to H, output H
ld h, b     60
call +o     cd xx xx
# output L
ld b, l     45
call +o     cd xx xx
# repeat
jr -s       18 xx
# output a two-digit BCD value followed by a space
.o
# output high digit
ld a, b     78
rra         1f
rra         1f
rra         1f
rra         1f
call +ob    cd xx xx
# output low digit
ld a, b     78
call +ob    cd xx xx
# output a space
ld e, #$20  1e 20
call 5      cd 00 05
# return
ret         c9
# output a single BCD digit
.ob
and #$f     e6 0f
add #$30    c6 30
ld e, a     5f
call 5      cd 00 05
ret         c9
```
[Answer]
# Clojure, 44 bytes
```
#(iterate(fn[[a b]][(+ a b)(- a b)])[%1 %2])
```
Function that produces an infinite lazy sequence.
[Answer]
# Perl 5, 40 bytes
requires `-E` (free)
```
sub a{say"@_";($c,$d)=@_;a($c+$d,$c-$d)}
```
~~or (same length)~~
```
$_=<>;{say;/ /;$_=$`+$'.$".($`-$');redo}
```
(I struck through the latter because it should have rounding errors for some iterations.)
[Hat-tip.](/a/76988)
But I suspect there must be a shorter Perl 5 solution.
[Answer]
# [RETURN](https://github.com/molarmanful/RETURN), 21 bytes
```
[¤.' ,$.'
,¤¤+2ª-F]=F
```
`[Try it here.](http://molarmanful.github.io/RETURN/)`
Recursive operator-lambda. Usage:
```
[¤.' ,$.'
,¤¤+2ª-F]=F10 2F
```
# Explanation
```
[                 ]=F  declare function F for recursion
 ¤.' ,$.'␊,            output top 2 stack items along with trailing newline
           ¤¤+2ª-      get plus and minus of top 2 stack items
                 F     recurse!
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 26 bytes
```
:?!;1-r:n48*o:@@:nao:@+}-$
```
Call with `a`, `b`, `n` on the stack, where `n` is the number of turns or a negative value for infinite output. Outputs `a` and `b` separated by a space.
As an explanation, here is how the stack evolves during runtime :
```
abn
nba
nbaa
naab
naabb
nabab
nab+
+nab
+n-
+-n
```
You can try it on [the online interpreter](https://fishlanguage.com/playground) with a positive amount of turns but you will need to use the official python interpreter to test the infinite mode.
> 
> 
> ```
> $ python fish.py -c ':?!;1-r:n48*o:@@:nao:@+}-$' -t 0.01 -v 10 2 -1
> 10 2
> 12 8
> 20 4
> 24 16
> 40 8
> 48 32
> 80 16
> 96 64
> 160 32
> 192 128
> 320 64
> 384 256
> 640 128
> 768 512
> 1280 256
> 1536 1024
> 2560 512
> 3072 2048
> 5120 1024
> 6144 4096
> 10240 2048
> 12288 8192
> 20480 4096
> 24576 16384
> 40960 8192
> 49152 32768
> 81920 16384
> 98304 65536
> 163840 32768
> 196608 131072
> 327680 65536
> 393216 262144
> 655360 131072
> 786432 524288
> 1310720 262144
> [...]
> 
> ```
> 
> 
[Answer]
## Seriously, 12 bytes
```
,,1WX■@│+)-1
```
Outputs an infinite stream, format is `b(n) a(n)`, one pair of outputs per line.
No online link because TryItOnline doesn't do so well with infinite loops.
Explanation:
```
,,1WX■@│+)-1
,,1           push a(0), push b(0), push 1
   W          while loop:
    X           discard the 1 (only used to make sure the while loop always runs)
     ■          print all stack elements, separated by spaces, without popping
      @│        swap, duplicate entire stack
        +)      push a(n) + b(n) (a(n+1)) and move it to the bottom of the stack
          -     push a(n) - b(n) (b(n+1))
           1    push 1 to make sure the loop continues
          
```
[Answer]
# J, ~~16~~ 12 bytes
```
0&(]+/,-/)~<
```
Produces only the first *k* values for the sequence based on the given seeds.
Saved 4 bytes using the trick (or syntactic sugar) shown by @randomra in this [comment](https://codegolf.stackexchange.com/questions/91154/sylvesters-sequence/91170#comment222297_91170).
## Usage
```
   f =: 0&(]+/,-/)~<
   2 20 f 10
  2   20
 22  _18
  4   40
 44  _36
  8   80
 88  _72
 16  160
176 _144
 32  320
352 _288
```
[Answer]
# C#, 50 bytes
```
f=(a,b)=>{Console.WriteLine(a+" "+b);f(a+b,a-b);};
```
Full source, including test case:
```
using System;
using System.Numerics;
namespace PlusMinusSequence
{
    class Program
    {
        static void Main(string[] args)
        {
            Action<BigInteger,BigInteger>f=null;
            f=(a,b)=>{Console.WriteLine(a+" "+b);f(a+b,a-b);};
            BigInteger x=10, y=2;
            f(x,y);
        }
    }
}
```
The BigInteger data type is used so the numbers don't overflow and become 0.
However, since it is a recursive solution, expect a stack overflow.
]