[Question]
  [
## Definitions
* An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of `2` is algebraic, because it is a zero of `x^2 - 2`.
* A transcendental number is a real number which is not algebraic.
## Task
You are to choose a transcendental number.
Then, write a program/function that takes a positive integer `n` and output the `n`-th **decimal** digit after the decimal point of your chosen transcendental number. You must state clearly in your submission, which transcendental number is used.
You can use 0-indexing or 1-indexing.
## Example
`e^2=7.389056098...` is a transcendental number. For this number:
```
n output
1 3
2 8
3 9
4 0
5 5
6 6
7 0
8 9
9 8
...
```
Note that the initial `7` is ignored.
As I mentioned above, you can choose other transcendental numbers.
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"). Lowest score in bytes wins.
  
[Answer]
# [Python](https://docs.python.org/2/), 3 bytes
```
min
```
[Try it online!](https://tio.run/nexus/python2#S7ON@Z@bmfe/oCgzr0RBXV0vKz8zTyM6TaO4pEijQlMzLb9IoUIhM0@hKDEvPVXD0MBAM1bzPwA "Python 2 – TIO Nexus")
Takes a number string, outputs its smallest digit as a smallest character. For example, `254` gives `2`. The decimal with these digits starts 
```
0.0123456789011111111101222222220123333333012344444401234555550123456666012345678801234567
```
This is [OEIS A054054](https://oeis.org/A054054).
**Claim:** This number `c` is transcendental
**Proof:** Note that `c` is very sparse: almost all of its digits are zero. That's because large `n`, there's high probability `n` has a zero digit, giving a digit min of zero. Moreover, `c` has long runs of consecutive zeroes. We use an existing result that states this means `c` is transcendental.
Following this [math.SE question](https://math.stackexchange.com/q/6321/24654), let `Z(k)` represent the position of the `k`'th nonzero digit of `c`, and let `c_k` be that nonzero digit, a whole number between `1` and `9`. Then, we express the decimal expansion of `c`, but only taking the nonzero digits, as as the sum over `k=1,2,3,...` of `c_k/10^Z(k)`.
We use the result of [point 4 of this answer](https://math.stackexchange.com/a/6565/24654) by George Lowther: that `c` is transcendental if there are infinitely many runs of zeroes that are at least a constant fraction of the number of digits so far. Formally, there must be an `ε>0` so that `Z(k+1)/Z(k) > 1+ε` for infinitely many `k`. We'll use `ε=1/9`
For any number of digits `d`, take `k` with `Z(k) = 99...99` with `d` nines. Such a `k` exists because this digit in `c` is a `9`, and so nonzero. Counting up from `99...99`, these numbers all contain a zero digit, so it marks the start of a long run of zeroes in `c`. The next nonzero digit isn't until `Z(k+1) = 1111...11` with `d+1` ones. The ratio `Z(k+1)/Z(k)` slightly exceeds `1+1/9`.
This satisfies the condition for every `d`, implying the result.
[Answer]
# Pyth, 1 byte
```
h
```
Input and output are strings. The function takes the first digit of the index. The resulting transcendental number looks like:
`0.0123456789111111111122222222223 ...`
This is transcendental because it is `1/9` plus a number which has stretches of zeroes of length at least a constant fraction of the number. Based on [this math.stackexchange answer](https://math.stackexchange.com/questions/6321/have-all-numbers-with-sufficiently-many-zeros-been-proven-transcendental/6565#6565), that means that the number is transcendental.
There are stretches of zeroes are from digit `100 ... 000` to `199 ... 999`, so ratio of `Z(k+1)` to `Z(k)` is 2 infinitely often.
Thus, the above number minus `1/9` is transcendental, and so the above number is transcendental.
[Answer]
# [Python 2](https://docs.python.org/2/), 19 bytes
```
lambda n:1>>(n&~-n)
```
The **n**th digit is **1** if **n** is a power of **2** and **0** otherwise.
[Try it online!](https://tio.run/nexus/python2#S1OwVYj5n5OYm5SSqJBnZWhnp5GnVqebp/m/oCgzr0QhN7FAI01HoSgxLz1Vw1BHwchQU/M/AA "Python 2 – TIO Nexus")
[Answer]
# brainfuck, 2 bytes
```
,.
```
Similarly to some other answers, returns the first decimal digit and ignores the rest.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
e!€
```
Uses Liouville's constant.
[Try it online!](https://tio.run/nexus/jelly#@5@q@Khpzf///w0B "Jelly – TIO Nexus")
[Answer]
## Retina, 4 bytes
```
1!`.
```
Returns the first digit of the input number. Because that port was so boring, here are some more ports:
```
O`.
1!`.
```
(8 bytes) Returns the minimum digit of the input number.
```
.+
$*
+`^(11)+$
$#1$*
^1$
```
(25 bytes) Returns 1 if the input number is a power of 2.
```
.+
$*_
$.`
+1`.(\d*)_
$1
1!`.
```
(30 bytes) Champernowne's constant.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog) 2, 7 bytes
```
⟦₁c;?∋₎
```
[Try it online!](https://tio.run/nexus/brachylog2#@/9o/rJHTY3J1vaPOrofNfX9/29k8D8KAA "Brachylog – TIO Nexus")
Calculates digits of the Champernowne constant (possibly times a power of ten due to indexing issues, which clearly don't matter here). Basically, this just concatenates together integers, and then takes the *nth* digit.
[Answer]
# Python 2, 13 bytes
Input and output are strings.
```
lambda n:n[0]
```
The number's nth digit is the most significant digit of n when it is written in decimal.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 7 bytes
```
4YA50<A
```
This uses the first of the two numbers given [here](https://en.wikipedia.org/wiki/Moser%E2%80%93de_Bruijn_sequence#Decimal_reciprocals) divided by 3 (which [maintains transcendence](https://en.wikipedia.org/wiki/Transcendental_number#Properties)):
> 
> 1.100110000000000110011...
> 
> 
> 
Input is 1-based.
[Try it online!](https://tio.run/nexus/matl#@28S6WhqYOP4/78hAA "MATL – TIO Nexus") Or [see the first 20 decimals](https://tio.run/nexus/matl#s1Jy@G8S6WhqYOP4P1Yt47@RAQA).
### Explanation
```
4YA     % Convert to base 4 using chars '0', '1', '2', '3' as digits
50<A    % Are all digits less than '2'? Gives 0 (false) or 1 (true) 
```
[Answer]
# JavaScript, 51 bytes
This function computes `n`th digit of Champernowne's Constant. Add `f=` at the beginning and invoke like `f(arg)`. Note that `n` is 1-indexed.
```
n=>[..."1".repeat(n)].map((c,i)=>c*++i).join``[n-1]
```
## Explanation
This function takes in a single argument `n`. It, then, creates an `n`-characters long String of repetitive 1s. Then, it splits that String into an Array of 1s . After that, it iterates over every element of the Array and multiplies them with their index in the Array incremented by 1. Then, it joins the Array together over `""` (empty String) to form a String. At last, it returns the `n`th element of the obtained String. 
**Note:** *The type of the returned value is always String*.
## Test Snippet
```
let f =
n=>[..."1".repeat(n)].map((c,i)=>c*++i).join``[n-1]
i.oninput = e => o.innerHTML = f(parseInt(e.target.value,10));
```
```
<input id=i><pre id=o></pre>
```
[Answer]
# Python 2, 43 bytes
Champernowne's constant.
```
lambda n:"".join(`i`for i in range(n+1))[n]
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 3 bytes
```
2|⍴
```
[Try it online!](https://tio.run/nexus/apl-dyalog#@@/4qG2CUc2j3i3//zs@6pjxqHfqoRWPejcbGgABAA "APL (Dyalog Unicode) – TIO Nexus") (the test suite generates a range of numbers from `1` to `10000`, converts them to a string, and then applies the train `2|⍴` on them).
Takes the input number as a string and returns its length mod 2. So `123` => `3 mod 2` => `1`.
The sequence starts off like so:
```
1  1  1  1  1  1  1  1  1  0  0  0  0  0  0  ...
```
so this can be generalised like so: `9 1s 90 0s 900 1s ...`
Multiplying this number by 9 gives us a [Liouville number](https://en.wikipedia.org/wiki/Liouville_number), which is proven to be transcendental.
[Answer]
# Haskell, ~~25 bytes~~ 17 bytes
```
(!!)$concat$map show[1..]
```
[Champernowne's Constant](https://en.wikipedia.org/wiki/Champernowne_constant) can be 0 or 1 indexed as C10\*.01 is still transcendental.
Edit:
as per nimis comment you can use the list monad to reduce this to
```
(!!)$show=<<[1..]
```
[Answer]
# JavaScript, 73 bytes
This is a program which computes the `n`th digit of the Liouville Constant, where `n` is the input number given by invoking the function `g` as `g(arg)` (and `n` is 1-indexed). Note that the newline in the code is necessary.
```
f=n=>n<1?1:n*f(n-1);g=(n,r=0)=>{for(i=0;i<=n;i++)if(f(i)==n)r=1
return r}
```
## Explanation
The program consists of two functions, `f` and `g`. `f` is a recursive factorial-computing function, and `g` is the main function of the program. `g` *assumes* to have a single argument `n`. It defines a default argument `r` with a value of 0. It, then, iterates over all the Integers from 0 to `n`, and, in each iteration, checks whether the function `f` applied over `i` (the current index) equals `n`, i.e. whether `n` is a factorial of `i`. If that happens to be the case, `r`'s value is set to 1. At the end of the function, `r` is returned.
## Snippet for Testing
```
f=n=>n<1?1:n*f(n-1);g=(n,r=0)=>{for(i=0;i<=n;i++)if(f(i)==n)r=1
return r}
i.oninput = e => o.innerHTML = g(parseInt(e.target.value,10))
```
```
<input id=i><pre id=o></pre>
```
**Warning:** *Don't put a very large value in the Snippet's input box! Otherwise, your device may freeze!*
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 1 byte
```
Ḣ
```
[Try it online!](https://tio.run/nexus/jelly#@/9wx6L///@rGxoYqAMA "Jelly – TIO Nexus")
1st digit of quoted 0-indexed input.1
1See isaacg's answer for proof of validity.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~3~~ ~~1+1= 2~~ 1 byte
Another port of [feersum's solution](https://codegolf.stackexchange.com/a/120631/58974).
Takes input as a string.
```
g
```
[Try it online](http://ethproductions.github.io/japt/?v=1.4.4&code=Zw==&input=IjgwIg==)
---
## Explanation
```
   :Implicit input of string U
g  :The first character of the string
```
[Answer]
# Pyth, ~~7~~ ~~5~~ 4 bytes
```
@jkS
```
[Try it online!](http://pyth.herokuapp.com/?code=%40jkUh&input=10&debug=0)
Uses Champernowne's constant.
Saved ~~2~~ 3 bytes thanks to Leaky Nun.
[Answer]
# Java 8, 18 bytes
Same as [Dennis' answer for Python 2](https://codegolf.stackexchange.com/a/120630/58251), the [Fredholm number](https://en.wikipedia.org/wiki/Transcendental_number#Numbers_proven_to_be_transcendental)
```
n->(n&(n-1))>0?0:1
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 24 bytes (noncompeting)
```
ＮαＡＩＵＶN⟦ＵＧPi⁺α¹⟧β§β⁺α›α⁰
```
[Try it online!](https://tio.run/nexus/charcoal#@/9@z7pzG9/vWfh@z8r3e7a@37PN79H8ZWDW8oDMR427zm08tPPR/OXnNh0CYjD/UQOIaNzw/78JAA "Charcoal – TIO Nexus")
**Note:** As of post time, does not work for `n` where `n` is a positive multiple of 14.
# Explanation
```
Ｎα                             Input number to a
   Ａ                  β        Assign to b
     Ｉ                         Cast
       ＵＶN                    Evaluate variable N
            ⟦ＵＧPi⁺α¹⟧         With arguments GetVariable(Pi) and a+1
                        §β⁺α›α⁰ Print b[a+(a>0)]
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~3~~ 1 byte
**EDIT**: Using the proof from the other answers, returns the first digit of input
```
¬
```
1-indexed for π (only up to 100000 digits)
```
žs¤
```
How it works
```
žs  # Implicit input. Gets n digits of pi (including 3 before decimal)
  ¤ # Get last digit
```
Or, if you prefer e (still 1-indexed) (only up to 10000 digits)
```
žt¤
```
[Try it online!](https://tio.run/nexus/05ab1e#@390X/GhJf//GxoYGAAA "05AB1E – TIO Nexus")
[Answer]
# TI-BASIC, 16 bytes
Basically tests if the input `N` (1-indexed) is a triangular number. This is the same as returning the `N`th digit of 0.1010010001…, which is [proven](https://math.stackexchange.com/a/781687/101777) to be transcendental. The sequence of digits is [OEIS A010054](https://oeis.org/A010054).
```
Input N
int(√(2N
2N=Ans(Ans+1
```
[Answer]
# [Duocentehexaquinquagesimal](https://esolangs.org/wiki/Duocentehexaquinquagesimal), 1 byte
*Ties [isaacg's Pyth answer](https://codegolf.stackexchange.com/a/120639/94066), [Erik the Outgolfer's Jelly answer](https://codegolf.stackexchange.com/a/120683/94066), [Neil A.'s 05AB1E answer](https://codegolf.stackexchange.com/a/120983/94066), and [Shaggy's Japt answer](https://codegolf.stackexchange.com/a/121403/94066) for #1.*
```
.
```
[Try it online!](https://tio.run/##S0oszvifnFhiYxPzqGGRXbx1cWqKgm6mgrphsXWcNVDIWl0hXsHILq80x7qkqDQPqDRVQbdY11Ah3jo1OSNfQTdPQR2oLOnQMuPDW5yP7stQsrPR1tXTiY5VetSw0Evdzg6isEY/v6BEP784MSkzFUopxNslWYOFk4oSM/PSSpOzESyFpP96/4EG/zc0MgYA)
[Answer]
# [Pyt](https://github.com/mudkip201/pyt), 5 bytes
```
Đř!∈Ɩ
```
[Try it online!](https://tio.run/##K6gs@f//yISjMxUfdXQcm/b/v5EJAA "Pyt – Try It Online")
Liouville Constant
```
Đ           implicit input (n); duplicate
 ř!         get [1!,2!,...,n!]
   ∈        is n in that list?
    Ɩ       coerce to integer; implicit print
```
[Answer]
# Regex (ECMAScript), 13 bytes
```
((xx|)x*)\1+$
```
[Try it online!](https://tio.run/##TY/NTsJAFEZfpTaG3kttocQYwziwcsGGhS6RxQQu7dXpdDIzQOVn6wP4iL5IxQWJybc7i@@cd7VTfuXYhsxbXpOrG/NBn52ThvbRC5XPrQU4yMmg30E7vQzbPr4V6W3XHxwwD81rcGxKwNxrXhE83GX3iMLLodhXrAlAS0dqrdkQIN5Is9Uaj6XUubeaAyRZgoI3AEaWuSZThgono9OJ/VzNgaVVztPMBCgXwyXiFdB/YCbFtBj/YQyVa/bxzOyU5nXklClpHMWpFpvGgeAnSYLTFC@HtYzbOHdkSQVgzGsVVhU4xKPv9ewlKsBfRyHsNvjggNMk@vn6jpK0XoyWV1VxPndFVowefwE "JavaScript (SpiderMonkey) – Try It Online")
Takes its input in unary, as a string of `x` characters whose length represents the number. The output is returned as the length of capture group `\2`.
Returns the \$n\$th digit of \$0.00020202220202220202220222220202222202220202220222220...\$, where the \$n\$th digit is \$2\$ if \$n\$ is a composite number, and \$0\$ otherwise.
```
           # tail = N = input number
((xx|)x*)  # \1 = the largest proper divisor of N;
           # \2 = 2 if \1 >= 2, or 0 otherwise;
           # tail -= \1
\1+$       # Assert that \1 divides tail
```
If the return value of `\2` is defined to be \$0\$ when it is unset, then this can be reduced to **12 bytes**, with \$0.00010101110101110101110111110101111101110101110111110...\$ as the transcendental number:
```
(x?(x)*)\1+$
```
[Try it online!](https://tio.run/##TY/NTsJAFEZfpTaG3kttocQYQx1YuWDDQpfoYgKX6dXpdDIzQOVn6wP4iL5IhUQTN9/mLL5z3uRW@qVjGzJveUWubsw7fXROGNpFT6QeWwuwF5NBv4N2Ci328aVIr7v@YI95aJ6DY6MAc695SXB3k90ill4My13FmgC0cCRXmg0B4pUwG63xoITOvdUcIMkSLHkNYITKNRkVKpyMjkf2czkHFlY6TzMTQC2Gr4h/gP4DMymmxfiCMVSu2cUzs5WaV5GTRtE4ilNdrhsHJT8IKjlN8XxYi7iNc0eWZADGvJZhWYFDPPhez56jAlw6itJugg8OOE2i78@vKEmhXoxep5f5FR4Pz8mnU1dkxej@Bw "JavaScript (SpiderMonkey) – Try It Online")
### Regex (ECMAScript), 14 bytes
```
((x*)(?=\2)x)*
```
[Try it online!](https://tio.run/##Tc@9bsIwFIbhW0kzkHOSJpCoqipcw9SBhaEdKYMFB8et41i2gZSftRfQS@yNpDAgdX6G73s/xE74lVM25N6qNbmmNZ/01TtuaB@9knzpLMCBT4ZpD9ClCFP@XmGHaZ8OD1iE9i04ZSRg4bVaETze5w@IzPMR29dKE4DmjsRaK0OAeMfNVms8Sq4Lb7UKkOQJMrUBMFwWmowMNU6q00n5uZiD4lY4TzMTQC5GS8Qb0H8wk3Jajq@MoXbtPp6ZndBqHTlhJI2jONNs0zpg6pkTU1mGl8GGx11cOLIkAigsGhFWNTjEox8M7CUqwLWjZHYbfHCgsiT6/f6JkqxZVMvbVXY@92VeVk9/ "JavaScript (SpiderMonkey) – Try It Online")
The output of this one is also returned as the length of capture group `\2`.
Returns the \$n\$th digit of \$0.01001100001111000000001111111100000000000000001...\$ (with 1-indexing). The \$n\$th digit of this transcendental number is the 2nd digit of the binary expansion of \$n+1\$, [OEIS A079944](https://oeis.org/A079944).
```
                # tail = N = input number
(
    (x*)(?=\2)  # \2 = floor(tail / 2); tail -= \2
    x           # tail -= 1
)*              # Iterate the above as many times as possible
```
[Answer]
# Fourier, 16 bytes
```
I~NL~S10PS~XN/Xo
```
[**Try it online!**](https://tio.run/nexus/fourier#@@9Z5@dTF2xoEBBcF@GnH5H//7@xuQUA)
As other answers have done, outputs the first digit of the input.
An explanation of the code:
```
N = User Input
S = log(N)
X = 10 ^ S
Print (N/X)
```
[Answer]
# JavaScript (ES6)
Just a few ports of some other solutions
---
## [feersum's Python solution](https://codegolf.stackexchange.com/a/120631/58974), 12 bytes
```
n=>(""+n)[0]
```
```
f=
n=>(""+n)[0]
o.innerText=f(i.value=1)
i.oninput=_=>o.innerText=f(+i.value)
```
```
<input id=i type=number><pre id=o>
```
---
## [Dennis' Python solution](https://codegolf.stackexchange.com/a/120630/58974), 13 bytes
```
n=>1>>(n&--n)
```
```
f=
n=>1>>(n&--n)
o.innerText=f(i.value=1)
i.oninput=_=>o.innerText=f(+i.value)
```
```
<input id=i type=number><pre id=o>
```
---
## [xnor's Python solution](https://codegolf.stackexchange.com/a/120635/58974), 20 bytes
```
n=>Math.min(...""+n)
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 6 + 3 ( `-c`) = 9 bytes
```
({}<>)
```
[Try it online!](https://tio.run/nexus/brain-flak#@69RXWtjp/n/v6GBwX/dZAA "Brain-Flak – TIO Nexus")
1st digit of 0-index string input (hence the `-c` flag).
[Answer]
# C#, 13 bytes
```
n=>(n+"")[0];
```
From feersum's solution. Almost same solution than the js port.
[Try it online](https://dotnetfiddle.net/zwjTyy)
[Answer]
# J, 2 Bytes
The same solution everyone else is using:
```
{.
```
Returns the first digit of n. IO is on strings
## Liouville's Constant, 9 Bytes
```
(=<.)!inv
```
Returns `1` if input is the factorial of an integer.
## Pi, 13 Bytes
```
{:":<[[email protected]](/cdn-cgi/l/email-protection)^
```
The last non-decimal digit of pi times 10^n.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
LḂ
```
[Try it online!](https://tio.run/##y0rNyan8/9/n4Y6m////KxkbmhiaWhqZmRorAQA "Jelly – Try It Online")
Take the length of the input number modulo 2. Equivalent to [this APL answer](https://codegolf.stackexchange.com/a/120674/61384).
]