Task

Create a program that, when run, would display all integers from   1   to      ∞      (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time.



An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integers are represented as a 32-bit unsigned value with 0 as the smallest representable value, the largest representable value would be 4,294,967,295.   Some languages support arbitrarily-large numbers as a built-in feature, while others make use of a module or library.

If appropriate, provide an example which reflect the language implementation's common built-in limits as well as an example which supports arbitrarily large numbers, and describe the nature of such limitations—or lack thereof.




 
# This very limited BCD-based collection of functions
# makes it easy to count very large numbers.  All arrays
# start off with the ones columns in position zero.
# Using arrays of decimal-based digits to model integers
# doesn't make much sense for most tasks, but if you
# want to keep counting forever, this does the trick. 
 
BcdInteger =
  from_string: (s) ->
    arr = []
    for c in s
      arr.unshift parseInt(c)
    arr
 
  render: (arr) ->
    s = ''
    for elem in arr
      s = elem.toString() + s
    s
 
  succ: (arr) ->
    arr = (elem for elem in arr)
    i = 0
    while arr[i] == 9
      arr[i] = 0
      i += 1
    arr[i] ||= 0
    arr[i] += 1
    arr
 
# To start counting from 1, change the next line!
big_int = BcdInteger.from_string "199999999999999999999999999999999999999999999999999999"
while true
  console.log BcdInteger.render big_int
  big_int = BcdInteger.succ big_int
 