[Question]
  [
### Definition
Let's call an (infinite) integer sequence universal if it contains every finite integer sequence as a contiguous subsequence.
In other words, the integer sequence **(a1, a2, …)** is universal if and only if, for each finite integer sequence **(b1, …, bn)**, there is an offset **k** such that **(ak+1, …, ak+n) = (b1, …, bn)**.
The sequence of positive prime numbers, for example, is not universal, among others for the following reasons.
* It doesn't contain any negative integers, **1**, or composite numbers.
* Although it contains **3**, it does not contain the contiguous subsequence **(3, 3, 3)**.
* Although it contains **2** and **5**, it does not contain the contiguous subsequence **(2, 5)**.
* Although it contains the contiguous subsequence **(7, 11, 13)**, it does not contain the contiguous subsequence **(13, 11, 7)**.
### Task
Pick *any* single universal integer sequence **(a1, a2, …)** and implement it in a programming language of your choice, abiding to the following rules.
* You can submit a full program or a function.
* You have three options for I/O:
	1. Take no input and print or return the entire sequence.
	2. Take an index **n** as input and print or return **an**.
	3. Take an index **n** as input and print or return **(a1, …, an)**.
* For I/O options *2* and *3*, you may use **0**-based indexing if you prefer.
* Your submission must be deterministic: if run multiple times with the same input, it must produce the same output.
In addition, unless it's immediately obvious, please prove that the sequence you picked is universal. Your proof may not depend on unproven conjectures.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply. May the shortest code in bytes win!
  
[Answer]
# [Husk](https://github.com/barbuz/Husk), 5 bytes
This prints an infinite list
```
ΣṖ…İ±
```
[Try it online!](https://tio.run/##ARQA6/9odXNr///Oo@G5luKApsSwwrH//w "Husk – Try It Online") or [find the first index of your sequence](https://tio.run/##ASAA3/9odXNr///igqzOo@G5luKApsSwwrH///9bMywtMSwwXQ). (Takes a lot of memory for most sequences)
### Explanation:
```
   İ±   Infinite list [1,-1,2,-2,3,-3,4,-4,5,-5...]
  …     Rangify       [1,0,-1,0,1,2,1,0,-1,-2,...]
 Ṗ      Powerset
Σ       Concatenate
```
In Husk `Ṗ` behaves nicely for infinite lists. You can see it's behaviour [here](https://tio.run/##yygtzv7//1HbREMDA4OHO6f5/f8PAA)
[Answer]
# [Python 2](https://docs.python.org/2/), ~~49~~ ~~46~~ 43 bytes
```
def f(n):d=len(`n`);return n/d**(n%d)%d-d/2
```
`f(n)` returns **an** only. This uses the smallest digit of `n` in base `d` to extract one of the higher digits.
[Try it online!](https://tio.run/##hVBBbsIwEDzjV6yQEHZwRBygDak40msP7Y0iEdUORMAmcoxqXk83prSqWqmRvLZ2Z2Zn0pzdrsb0ctGmhJKjyPXiYJBvcCMerHEni4BjHUUcB1oMdKzHacBuuRc562lYgEogiuBYeN6dwN5vBIxAQVlb2EOF4IVk8OcX8F3x4koSrIekmjDW@6av8jxWa1oYZggRaMLu6ZAhxn50r364hhjSoEjzWxTG3nfVwcCLPRlSc/bcaXpiV9icHBefG7p4ROsVbWusAwIsKGHDSwm2wK3hKGnfCK7GRcA2tkKC0kBC/xX7X4GNfzONg@XT49La2ua//oQtqtbA87l15rj0leMJ@bixwlXVCEULnefPPcOyoCA6h6EE/7@iEpdVsmarRCqZygm9JjJWctqVmYzn1Izv5Iz66b2SWZpJlaUym3adZB3NQ1VJuKbzDw "Python 2 – Try It Online") This script (courtesy of Dennis) takes any finite sequence and gives you an `n` where that sequence begins.
## Explanation
```
n/d**(n%d)%d-d/2
     (n%d)         least significant digit of n
n/d**(   )%d       get n%d-th digit of n
            -d/2   offset to get negative values
```
For example, for `n` in the range `3141592650` to `3141592659`, `d=10` and the last digit of `n` selects one of the other digits. Then we add `-d/2` to get negative values.
```
n%d:       0  1  2  3  4  5  6  7  8  9
f(n)+d/2:  0  5  6  2  9  5  1  4  1  3
f(n):     -5  0  1 -3  4  0 -4 -1 -4 -2
```
Standalone alternative, also 43 bytes:
```
n=input();d=len(`n`);print n/d**(n%d)%d-d/2
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog) 2, 11 bytes
```
≜~×-₂ᵐ~ȧᵐ≜∋
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/qG3Do6bGh9sWHNr5qHEDHJX/f9Q5p@7wdN1HTU0Pt06oO7EcSAKFHnV0//8PAA "Brachylog – Try It Online")
I also tried an algorithm using additive partitions on a list, but it wasn't any shorter. This is a generator that produces an infinite stream of integers as output; the TIO link has a header to print the first ten thousand of them.
## Explanation
The program starts off by trying all possible integers in sequence (`≜` tries all remaining possibilities, for integers by default). That's 0, 1, -1, 2, -2, etc. (although the negative integers don't reach the end of the program). This is the only "infinite" step of the program; all the others are finite.
`~×` then generates all possible factorisations of the integer, treating different orders as different, and using only values from 2 upwards (so there are only finitely many); note that composite numbers are allowed in the factorisation, not just primes. This means that all possible sequences of integers ≥ 2 will be generated by this step at some point in the execution of the function (as such a sequence necessarily has some product, and that product will be generated at some point by the initial `≜`).
We then need to map the set of those sequences onto the set of all integer sequences, which is done in two steps: subtracting 2 (`-₂`) from each element (`ᵐ`), giving us the set of all nonnegative integer sequences, then taking plus or minus (`~ȧ`, i.e. "a value whose absolute value is") each element (`ᵐ`). The latter step is obviously nondeterministic, so Brachylog treats it as a generator, generating all possible lists whose elements are plus or minus the corresponding element of the input list. This means that we now have a generator for all possible integer sequences, and it generates them in an order that means they're all generated (specifically, the order that you get if you take the absolute value of each element, add 2 to each element, and then order by the product of the resulting elements).
Unfortunately, the question wants a single sequence, not a sequence of sequences, so we need two more commands. First, `≜` requests Brachylog to explicitly *generate* the sequence of sequences strictly (as opposed to producing a data structure describing the concept of a sequence generated via this method, and not actually generating the sequences until necessary); this both happens to make the program faster in this case, and ensures that the output is produced in the requested order. Finally, `∋` causes the generator to output the elements of the individual sequences one at a time (moving onto the next sequence once it's output all elements of the previous one).
The end result: each possible integer sequence gets generated and output, one element at a time, and all concatenated together into a single universal sequence.
[Answer]
# Pyth - 11 bytes
`n`th power cartesian product of `[-n, n]`, for all `n`.
```
.V1js^}_bbb
```
[Try it online here](http://pyth.herokuapp.com/?code=VQjs%5E%7D_NNN&input=4&debug=0) (finitely).
[Answer]
# [Python 2](https://docs.python.org/2/), ~~100~~ 99 bytes
* Saved one byte thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs); iterating over an `itertools` built-in to indefinitely loop.
```
from itertools import*
for n in count():
 for P in permutations(range(-n,n)*n):
	for p in P:print p
```
[Try it online!](https://tio.run/##FcqxDYAwDATAGqZwmSBoKJkiKyAUwBJ5W8YUTB9Iezp9/RTMte4mhdizuch1ExcV86HfxQjEoE0eeIhLT41SI81WHl@dBXewFUcOE0bEAX/rWtPW0qLGcNJaPw "Python 2 – Try It Online")
Indefinitely prints all permutations of the `n`-times repeated integer range `[-n; n)` for all nonnegative integers `n`.  
You can search for the first offset `k` for any subsequence using [this modified version](https://tio.run/##bY8xb8MgEIVn8ytOmUxiItzR6Dp2zlzLg1XhBhkfFIiqLv7rDibJVokB3vve3cP/paujty3qn5umLw0IvWgbkOW0A4vGakoA2fgYbdRbxH5QFrNav0JczbhKNgW3gEk6JOdsBLN4F9JREUr2e81jVtmxanIBLmAIvA7LLY3JOIp1GOlb14Ia4kfiGSuc37nL/qrMBOQSPNp0Ppjcye9GPKFv1HzC9onFXthuQHyVK/H/8kUvt8MMeGjEOgurPndZ28yXH/J328Wzd76WnFWU12zbHQ).
[Answer]
# [Perl 6](https://perl6.org), 91 bytes
```
loop (my$i=1;;$i++){my@n=(-$i..$i);my@m=@n;loop (my$k=1;$k <$i;$k++){@m=@m X@n;};print @m;}
```
[Try it online!](https://tio.run/##K0gtyjH7/z8nP79AQSO3UiXT1tDaWiVTW1uzOrfSIc9WQ1clU09PJVPTGsjNtXXIs4YrzQYqVclWsFHJBFIgDSD5XIUIoJpa64KizLwSBYdc69r//wE "Perl 6 – Try It Online")
This uses a similar method to some of the other answers. It uses Cartesian products to print the elements of `(-1,0,1)`, then all ordered pairs of the elements in `(-2,-1,0,1,2)`, then all ordered triplets of the elements in `(-3,-2,-1,0,1,2,3)`, etc.
I'm new to Perl, so there might be more golfing that could be done.
More readable version:
```
loop (my $i = 1; ; $i++) {
  my @n = (-$i..$i);
  my @m = @n;
  loop (my $k=1; $k <$i; $k++) {
    @m = @m X @n;
  }
  print @m;
}
```
]