[Question]
  [
Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to [Champernowne's constant](https://en.m.wikipedia.org/wiki/Champernowne_constant)):
```
0123456789101112131415161718192021222324252627282930...979899100101102103...
```
Write a program or function that takes in a nonnegative integer that indexes (0-based) into this infinite string. Output a [truthy](https://codegolf.meta.stackexchange.com/a/2194/26997) value if the digit indexed is 0, otherwise output a [falsy](https://codegolf.meta.stackexchange.com/a/2194/26997) value if the digit is 1-9.
The shortest code in bytes wins.
The first 25 truthy-producing inputs are:
```
0
11
31
51
71
91
111
131
151
171
191
192
194
197
200
203
206
209
212
215
218
222
252
282
312
```
Kudos if your program is memory effecient, but this is not a requirement.
  
[Answer]
## Haskell, 25 bytes
```
(<'1').((show=<<[0..])!!)
```
Usage example: `(<'1').((show=<<[0..])!!) 312` -> `True`
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 5 bytes
Code:
```
ÝJ¹è_
```
Explanation:
```
Ý      # Get the list [0 .. input].
 J     # Join the list.
  ¹    # Get the first input again.
   è   # Get the character on that index.
    _  # Logical negate (0 -> 1, everything else -> 0).
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=w51KwrnDqF8&input=MjE4)
[Answer]
# Mathematica, ~~42~~ 40 bytes
```
(0@@Join@@IntegerDigits@Range@#)[[#]]<1&
```
Anonymous function. Takes a number as input and returns either `True` or `False` as output. A longer, yet more efficient(?) solution:
```
RealDigits[ChampernowneNumber[],10,1,-#][[1,1]]<1&
```
[Answer]
## CJam, 9 bytes
```
{_),s=~!}
```
This is an unnamed block (function) which takes in an integer and returns 0 or 1 accordingly.
Explanation:
```
{       }        Defines a block
 _               Copy input n
  ),             Increment n and take range
    s            Convert to string - for a list of numbers this concatenates
                 the digits
     =           Index, getting nth digit
      ~          Evaluate the digit character into a number
       !         Logical negation
```
[Online interpreter](http://cjam.aditsu.net/#code=11%20%7B_%29%2Cs%3D~!%7D%20~). Note that `~` evaluates a block. Alternative, you can run this [test suite](http://cjam.aditsu.net/#code=1000%20%7B_%29%2Cs%3D~!%7D%2C%20p) which uses `,` to filter the first 1000 numbers for truthy values.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
RDF⁸ị¬
```
[Try it online!](http://jelly.tryitonline.net/#code=UkRG4oG44buLwqw&input=&args=MTEx) or [verify all test cases](http://jelly.tryitonline.net/#code=UkRG4oG44buLwqwKMzEz4bi2w4fDkGY&input=).
### How it works
```
RDF⁸ị¬  Main link. Argument: n
R       Range; yield [1, ..., n].
 D      Decimal; convert all integers in that range to base 10 arrays.
  F     Flatten the result.
   ⁸ị   Extract the digit at index n (1-based).
        This returns 0 if the array is empty (n = 0).
     ¬  Logical NOT; return 1 if the digit is 0, 0 if not.
```
[Answer]
# MATL, 11 bytes
```
Qt:qVXzw)U~
```
[**Try it Online!**](http://matl.tryitonline.net/#code=UXQ6cVZYencpVX4&input=MTE)
**Explanation**:
```
    % Implicitly grab input as an integer (N)
Qt  % Add 1 and duplicate
:q  % Create an array from [0 ... N]
V   % Convert each entry to a string (places spaces between each number)
Xz  % Remove all whitespace
w)  % Get the N+1 element of the string (since MATL uses 1-based indexing natively)
U~  % Convert the result back to a number and negate which yields TRUE if it was '0' and
    % FALSE otherwise
```
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), ~~10~~ 8 bytes
**2 bytes thanks to Fatalize.**
```
y@ec:?m0
```
[Try it online!](http://brachylog.tryitonline.net/#code=eUBlYzo_bTA&input=MzEy)
```
y@ec:?m0
y         range from 0 to Input, inclusive,
 @e       the digits of every number in that range,
   c      concatenated
    :?m   the Input-th digit
       0  is zero.
```
[Answer]
# [Perl 6](http://perl6.org/), ~~26~~ 25 bytes
```
{!+map(|*.comb,0..*)[$_]}
```
A lambda that takes a number as input and returns a `True` or `False`.
Memory-efficient.
**How it works**
1. `0..*` – Construct the range from 0 to infinity.
2. `map(|*.comb, )` – Lazily iterate the range, replacing each number with the characters of its string representation, and returning a new lazy sequence. The `|` keeps the new sequence flattened.
3. `[$_]` – Take the element at the index defined by the (implicitly declared) lambda parameter `$_`.
4. `+` – Coerce it to a number. *(This step is needed because coercing a string directly to a boolean always gives True unless the string is empty.)*
5. `!` – Coerce it to a boolean and negate it.
([try it online](https://glot.io/snippets/ehx8swz0lk))
*EDIT: -1 byte thanks to b2gills.*
[Answer]
# Python 3.5, 40 bytes
```
lambda n:('%d'*-~n%(*range(n),n))[n]<'1'
```
Test it on [repl.it](https://repl.it/CxxI).
### How it works
For input **n**, `'%d'*-~n` repeats the format string **n + 1** times.
`(*range(n),n)` unpacks the range **[0, ..., n - 1]** and yields the tuple **(0, ..., n)**.
`...%...` replaces each occurrence of **%d** with the corresponding integer in the range, yielding the string **01234567891011...n**.
`(...)[n]<'1'` selects the character at index **n** and tests if it is less than the character **1**.
[Answer]
# Python 3, 44 bytes
```
lambda n:''.join(map(str,range(n+1)))[n]<'1'
```
An anonymous function that takes input via argument and returns `True` or `False` as appropriate.
**How it works**
```
lambda n      Anonymous function with input n
range(n+1)    Yield the range [0, n]...
map(str,...)  ...convert all elements to string...
''.join(..)   ...concatenate...
...[n]        ...yield nth character...
:...<'1'      ...return True if int(character)==0 else return False
```
[Try it on Ideone](https://ideone.com/YqPZNg)
[Answer]
# Pyth, ~~8~~ 7 bytes
*Thanks to @LeakyNun for -1 byte*
```
!s@jkUh
```
This is my first attempt at golfing in Pyth.
A full program that prints `True` or `False` as appropriate.
[Try it online](https://pyth.herokuapp.com/?code=%21s%40jkUh&debug=0)
[First 25 truthy inputs](https://pyth.herokuapp.com/?code=FNr0+313I%21s%40jkUhNNN&test_suite_input=0%0A1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A9%0A10%0A11&debug=0)
**How it works**
```
!s@jkUh    Program. Input: Q
      hQ   Head. Yield Q+1
     U     Unary range. Yield [0, Q]
   jk      Join. Join on empty string
  @     Q  Index. Yield string[Q]
 s         Integer. Convert to integer
!          Logical negation. 0 -> True, all other digits -> False
           Print. Print result implicitly
```
[Answer]
# [S.I.L.O.S](http://github.com/rjhunjhunwala/S.I.L.O.S), 141 bytes
```
readIO
i+1
lblL
c=C
p=1
lblc
p*10
c/10
if c c
p/10
lbln
m=C
m/p
m%10
p/10
i-1
if i C
GOTO H
lblC
if p n
C+1
GOTO L
lblH
m/m
m-1
m|
printInt m
```
[Try it online!](http://silos.tryitonline.net/#code=cmVhZElPCmkrMQpsYmxMCmM9QwpwPTEKbGJsYwpwKjEwCmMvMTAKaWYgYyBjCnAvMTAKbGJsbgptPUMKbS9wCm0lMTAKcC8xMAppLTEKaWYgaSBDCkdPVE8gSApsYmxDCmlmIHAgbgpDKzEKR09UTyBMCmxibEgKbS9tCm0tMQptfApwcmludEludCBt&input=&args=MzEy)
Uses only 5 integers, maximum memory efficiency \o/
### Explanation
We generate as many digits as the input in the Champernowne's constant.
In the main loop, we do the following:
* Find the length of the current number by floor\_dividing it by 10 repeatedly until it reaches 0, and then count the number of divisions used.
* Instead of storing the number of divisions, we store 10 to that number power instead.
* Iterate through each digit as such: the `100`s digit of `1234` is obtained by `(1234/10)%10` where `/` is floor division.
* For each digit generated, take 1 from the input, while checking if the input reached zero.
* If the input reaches zero, check if the current digit is 0 and then halts.
[Answer]
## JavaScript (ES6), 45 bytes + Kudos
```
f=(n,s='0')=>s[n]?!+s[n]:f(n-s.length,-~s+'')
```
My best non-Kudos version was 34 bytes:
```
n=>!+(g=s=>s[n]||g(s+i++))('',i=0)
```
[Answer]
# JavaScript (ES6), 47 bytes
`n=>[...Array(n+1)].reduce((a,_,i)=>a+i,'')[n]<1`
[Answer]
## Javascript (ES6), ~~42~~ 33 bytes
```
n=>!+(r=i=>i>n?'':i+r(i+1))(0)[n]
```
Example:
```
let f =
n=>!+(r=i=>i>n?'':i+r(i+1))(0)[n]
// test all integers in [0, 312]
for(var n = 0, list = []; n <= 312; n++) {
  f(n) && list.push(n);
}
console.log(list.join(','));
```
[Answer]
# Groovy, 56 bytes
```
def f(n){def s=''<<'';(0..n).each{s<<it};!(s[n] as int)}
```
Nothing fancy, but I'm trying out some new things.
```
def f(n) {
  def s = ''<<''           // declare a StringBuffer
  (0..n).each { s << it }
  !(s[n] as int)           // Groovy considers a non-null char truthy, so we have to cast 
}
```
[Answer]
# Perl, 24 bytes
Includes +1 for `-p`
Run with input on STDIN:
```
zero.pl <<< 31
```
print 1 for zero, nothing otherwise
`zero.pl`
```
$_=!(map/./g,0..$_)[$_]
```
[Answer]
# zsh, 31 bytes
```
exit ${${(j..):-{0..$1}}[$1+1]}
```
`exit 0` is true in zsh
[Answer]
# PHP, 36 bytes
```
<?=!join(range(0,$a=$argv[1]))[$a];
```
Print `1` if Champernowne argument-th decimal is `0`, else print '' (empty string).
[Answer]
# Ruby, ~~35~~ 23 bytes
This is an anonymous function that concatenates `[0..n]`, takes the `n`th index and checks if that char is `"0"` (less than `"1"`). Golfing suggestions welcome.
```
->n{([*0..n]*'')[n]<?1}
```
**Ungolfing**
```
->n{...}   # Create an anonymous function with parameter n.
[*0..n]    # Create an array of the range [0..n].
[...]*''   # Join the array using the empty string.
(...)[n]   # Take the char at the n-th index of the string.
<?1        # Check if the char is < "1" (that is, "0").
```
[Answer]
# Bash, ~~31~~ 28 bytes
```
seq -s "" 0 $1|egrep ^.{$1}0
```
Output is non-empty (truthy) or empty (falsy). Test it on [Ideone](http://ideone.com/7MOc2A).
[Answer]
# Julia, ~~21~~ 20 bytes
```
!n=join(0:n)[n+1]<49
```
*Thanks to @LuisMendo for golfing off 1 byte!*
[Try it online!](http://julia.tryitonline.net/#code=IW49am9pbigwOm4pW24rMV08NDkKCmZvciBuIGluIDA6MzEyCiAgICBpZiAhbiBwcmludGxuKG4pIGVuZAplbmQ&input=)
[Answer]
# R, 61 57 bytes
Thanks to @plannapus for 4 bytes.
```
n=scan();strsplit(paste(0:n,collapse=""),"")[[1]][n+1]==0
```
Creates a vector of numbers 0:n (for 0 indexing), creates a string of them, pulls the nth value from string (adjusting for 0 indexing). Converts to numeric and tests if it is 0.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 14 [bytes](https://codegolf.meta.stackexchange.com/questions/9428/when-can-apl-characters-be-counted-as-1-byte-each/9429#9429)
```
{~×⍎⍵⊃∊⍕¨⍳1+⍵}
```
[Try it online!](https://tio.run/##Jc49CsJAEAXgPqdIL0Jm15ikFsRUguYCAVGLgOJPEUSbQJDAihbByt7OQryA3mQuEndeivlg5z3YSddZd5an2WrR8KWOx1xeveZw@t3ZXNh8uCr4XLGpv082b@rY1bGZ25LE6FfF96W5vNnXdDKwJqN42rB5uMM02@bO3CU7yo6WIYLacaSSbPa7pXQ86bWRxRcCISIEEBEhI4TUppGCPRjIZ54HNezDSCQFfRiKChsfhjiS1B8 "APL (Dyalog Unicode) – Try It Online")
## Explanation
```
{~×⍎⍵⊃∊⍕¨⍳1+⍵}     ⍝ 
{            }     ⍝ A dfn, in this case with a single argument (⍵)
         ⍳1+⍵      ⍝ Computes the range of 0..arg
       ⍕¨          ⍝ For each (¨), convert to a string (⍕)
      ∊            ⍝ Enlist all strings into a single string
    ⍵⊃             ⍝ Pick (⊃) the element at the index of the given arg (⍵)
   ⍎               ⍝ 'Execute' to treat it as a numeric
  ×                ⍝ Turn >1 into 1
 ~                 ⍝ Negate
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 38 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 4.75 bytes
```
ʀṅi0=
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyI9IiwiIiwiyoDhuYVpMD0iLCIiLCIzMiJd)
[Answer]
# GolfScript, 12 bytes
```
~.),""*\=48=
```
Explanation:
```
~             Evaluate the input.
 .            Duplicate it
  )           Increment the duplicate.
   ,          Create an array from 0 to it.
    ""*       Join it with an empty string.
       \=     Get the n-th index of this string, where n is the input
         48=  Is it equal to 0?
```
[Try it online](http://golfscript.tryitonline.net/#code=fi4pLCIiKlw9NDg9&input=MTEx) or [verify all test cases!](http://golfscript.tryitonline.net/#code=bi97fi4pLCIiKlw9NDg9fVwlbio&input=MAoxMQozMQo1MQo3MQo5MQoxMTEKMTMxCjE1MQoxNzEKMTkxCjE5MgoxOTQKMTk3CjIwMAoyMDMKMjA2CjIwOQoyMTIKMjE1CjIxOAoyMjIKMjUyCjI4MgozMTI)
[Answer]
**C, 154 bytes**
```
s(n,v,k,z){for(k=1;(z=n%10,n/=10)&&!v||k<v;++k); return v?z:k;}
f(n,i,j,c){for(i=0,j=0;;++i){c=s(i,0,0,0);j+=c;if(j>n){c=s(i,j-n,c,0);break;}}return !c;}
```
the function that calculate the value is f(n,0,0,0) where n is the input index.
it can calculate from index changing "return !c" in "return c" the value of the array in that index... 
i don't understand how but it seems to work ok....
```
main()
{int   i,r;
 char  a[]="0123456789101112131415161718192021222324252627282930313233343536";
 for(i=0; i<1000; ++i) 
    if(r=f(i,0,0,0))  
        printf("%u|",i);
}
/*
 154
 0|11|31|51|71|91|111|131|151|171|191|192|194|197|200|203|206|209|212|215|218|222
|252|282|312|342|372|402|432|462|491|492|494|497|500|503|506|509|512|515|518|522|552
|582|612|642|672|702|732|762|791|792|794|797|800|803|806|809|812|815|818|822|852
|882|912|942|972|
*/
```
[Answer]
# Javascript (ES5): 61 60 bytes
```
function(b){for(s="";s.length<b;)s+=s.length;return 0==s[b]}
```
Ungolfed:
```
function a(b){
  for(var s="";s.length<b;)
    s+=s.length;
  }
  return (s[b]==0);
}
```
Old:
```
function(n){s="";while(s.length<n)s+=s.length;return s[n]==0}
```
Ungolfed old:
```
function a(n){
  var str="";
  while(str.length<n)str+=str.length; //Create String as long as needed
  return str[n]==0 //Check for 0 and return
}
```
[Answer]
# CoffeeScript, 56 bytes
```
a=(b)->
 s=""
 while s.length<b #loop for building string with required length
  s+=s.length     #add number
 "0"==s[b]        #return, if the number at the position equals zero
```
[Answer]
# C#, 71 bytes
And I thought it was short at first, but then I had to add `n+=11` to prevent it from throwing a `System.IndexOutOfRangeException` when numbers below 11 were input
```
return String.Join("",Enumerable.Range(0,n+=11).ToArray())[n]=='0'?1:0;
```
]