Count up forever

71

8

Write a program that counts up forever, starting from one.

Rules:

  • Your program must log to STDOUT or an acceptable alternative, if STDOUT is not available.
  • Your program must be a full, runnable program, and not a function or snippet.
  • Your program must output each number with a separating character in between (a newline, space, tab or comma), but this must be consistent for all numbers.
  • You may print the numbers in decimal, in unary or in base 256 where each digit is represented by a byte value.
  • Your program must count at least as far as 2128 (inclusive) without problems and without running out of memory on a reasonable desktop PC. In particular, this means if you're using unary, you cannot store a unary representation of the current number in memory.
  • Unlike our usual rules, feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

    Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

  • This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Catalogue

The Stack Snippet at the bottom of this post generates the catalogue 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 = 63834; var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk"; var OVERRIDE_USER = 39069; var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page; function answersUrl(index) { return "//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 "//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(42), 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>

vrwim

Posted 2015-11-14T12:40:24.093

Reputation: 2 223

29I'm not sure how to combine must output each number with a separating character in between with may print the numbers [...] in base 256. – Dennis – 2015-11-14T14:25:07.607

6

For future challenges, may I recommend the sandbox such that all these details could be sorted out before people start posting answers? :)

– Martin Ender – 2015-11-14T14:32:31.657

Has anyone bothered to build a binary increment routine in BotEngine yet? – SuperJedi224 – 2015-11-14T16:25:29.790

1Can we use unary output even if our language does support other form of outputs? – Zereges – 2015-11-14T16:59:16.000

Nitpick: Your "reasonable desktop PC" won't be able to "count at least as far as 2¹²⁸", however much or little memory it has. In fact, that's beyond the capabilities of any computer humankind could build using known technology.

– Ilmari Karonen – 2015-11-15T04:27:23.277

3@IlmariKaronen I interpret that as being a memory limit, not a time limit. possibly a time limit on per-increment. just set the counter to 2**128-10 and see how long it takes to take those last ten steps. – Sparr – 2015-11-15T07:41:43.243

5Can we have leading zeroes in the output? – Paŭlo Ebermann – 2015-11-15T11:43:00.567

4Ugh!!! I have an answer for TI-89 (56b), but I can't post b/c I'm new to the site and don't have Rep 10+! – gregsdennis – 2015-11-15T20:45:50.373

In particular, this means if you're using unary, you cannot store a unary representation of the current number in memory. That kind of ruins the possibility of anyone using unary. – mbomb007 – 2015-11-16T20:21:49.257

@mbomb007 Nope. You can keep the current n in memory as a "normal" number and then use it to iterate from 0 to n-1 printing a single 1 each time. – Martin Ender – 2015-11-16T20:28:47.977

@MartinBüttner But I mean that it's likely not shorter in any language, since if that language can hold a "normal" number, it can probably print it. – mbomb007 – 2015-11-16T20:30:39.883

1@mbomb007 Surely, it's much shorter in any language that can't print a number directly to STDOUT like Brainfuck, where you'd have to implement a decimal (or binary) string printer yourself. – Martin Ender – 2015-11-16T20:31:34.230

@MartinBüttner You may print the numbers... in base 256 where each digit is represented by a byte value. – mbomb007 – 2015-11-16T20:32:40.970

@mbomb007 Not shorter to do base-256 conversion either (Brainfuck was a bad example... consider any of the Brainfuck derivatives that can hold arbitrary-size integers). – Martin Ender – 2015-11-16T20:33:49.803

Let us continue this discussion in chat.

– mbomb007 – 2015-11-16T20:34:10.343

1Do you intend to test submissions by watching them count all the way to 2^128? – Octopus – 2015-11-17T19:46:53.097

@Octopus nope, but one can prove that given enough time and memory, the code will reach 2^128. – vrwim – 2015-11-17T23:23:38.103

Objective C - 84 Bytes. Unfortunately. i have rep issues (this is my first time at codegolf) so i put it here. – x13 – 2015-12-30T12:36:56.347

What does the phrase "log to STDOUT" mean? Does "log" imply that the numbers must all be kept for kept for inspection? If not, is there some kind of (implied) buffer length or is it acceptable to overwrite the same position? – Stuart Bruff – 2016-04-25T16:01:27.417

3I think this could be a chameleon challenge, since many languages can't count to 2^128, but only 2^127. – None – 2016-07-22T11:54:28.430

What about binary, hex, base36 and others? – Titus – 2016-12-06T15:16:49.233

Repeating Paŭlo Ebermann's question: Can we print leading zeros in decimal? – Jakob – 2017-10-09T19:41:37.130

@gregsdennis 56 bytes is less than this one? You have enough rep now.

– Engineer Toast – 2018-01-26T22:55:51.820

I'm pretty sure most of the answers here don't support numbers up to 2^128. – 12Me21 – 2018-02-23T22:59:02.590

Answers

63

Labyrinth, 5 bytes

):
\!

♫ The IP in the code goes round and round ♫

Relevant instructions:

)       Increment top of stack (stack has infinite zeroes at bottom)
:       Duplicate top of stack
!       Output top of stack
\       Output newline

Sp3000

Posted 2015-11-14T12:40:24.093

Reputation: 58 729

78The program is sad that its not stopping.. – Optimizer – 2015-11-14T17:10:39.827

7@Optimizer def sad( indeed ): – YoYoYonnY – 2015-11-16T18:11:55.787

1Why is this not 4 bytes? – Aurel Bílý – 2015-12-30T11:17:48.640

2@Aurel300 The fifth byte is the newline between : and \ – Sp3000 – 2015-12-30T12:10:03.143

@Sp3000 Ah, yes. Silly me. :) – Aurel Bílý – 2015-12-30T15:04:12.437

46

><>, 8 bytes

01+:nao!

Steps:

  • Push 0 on the stack
  • Add 1 to the top stack element
  • Duplicate top stack element
  • Output the top of the stack as number
  • Output a newline
  • Go to step 2 by wrapping around and jumping the next instruction (step 11)

(A less memory efficient (hence invalid) program is llnao.)

randomra

Posted 2015-11-14T12:40:24.093

Reputation: 19 909

66+1 for the impatient upvote-demanding implicit in a line of code that basically reads “plus one, now!”. – Janus Bahs Jacquet – 2015-11-14T14:39:43.850

25

Haskell, 21 bytes

main=mapM_ print[1..]

Arbitrary-precision integers and infinite lists make this easy :-)

Luckily mapM_ is in the Prelude. If Data.Traversable was as well, we even could shrink it to 19 bytes:

main=for_[1..]print

Bergi

Posted 2015-11-14T12:40:24.093

Reputation: 967

Isn't there a symbol that generalizes map/mapM etc? – JDługosz – 2015-11-16T02:41:01.597

@JDługosz: not that I know – Bergi – 2015-11-16T03:09:21.343

Ah, 'cause it would still have to sequence the result to get the output to really happen. – JDługosz – 2015-11-16T03:27:24.213

isnt simply [1..] allowed, since it prints all numbers with a comma in beween? or the first [ screw it all up? – Baconaro – 2015-12-30T11:06:13.970

@Baconaro: that's a list, it doesn't print anything. GHCi does print the result if you enter the term in the repl, but that's not a runnable program. And yes, the leading [ is not allowed either. – Bergi – 2015-12-30T11:54:24.957

1With leading [ allowed you could say main=print[1..] – Christian Sievers – 2016-07-23T12:36:52.403

Are you sure this will run forever? Won't it accumulate a slew of never-used thunks to build the final [()..] result? I would think you'd need mapM_, but I could be wrong. – dfeuer – 2019-03-05T06:14:44.193

@dfeuer I haven't tried, I don't have that much time… Honestly I just don't know, you might be right. – Bergi – 2019-03-05T12:18:04.787

@dfeuer OK I was curious and did try now, it seems that you were right. mapM_ does have much lower memory usage and doesn't accumulate like mapM did. I really had hoped the compiler would be able to discard the unused result :-/ – Bergi – 2019-03-05T12:36:53.127

The compiler doesn't know how. We have something that looks like mapM f (x:xs)=liftA2(:)(f x)(mapM f xs). That boils down to something like mapM f (x:xs)=IO$\s->case unIO(f x)s of(#s',y#)->case unIO(mapM f xs) of(#s'',ys#)->(#s'',y:ys#). GHC would have to see, in context, that the result isn't used, and compile a special version of mapM f that doesn't calculate the result. The garbage collector doesn't have much hope of figuring it out dynamically, either. This stuff is ... tricky. – dfeuer – 2019-03-06T04:21:19.270

@dfeuer You mean that it doesn't only leak the list elements, but also the case unIO(…) … thunks around the recursive call are left on the stack? I see, applying a tail call optimisation depending on the non-usage of the result is kinda hard. – Bergi – 2019-03-06T16:25:50.997

@Bergi, that's it, though I'm not sure those are technically thunks on the stack. Stack frames, anyway. – dfeuer – 2019-03-06T17:50:02.220

23

Gol><>, 3 bytes

P:N

Steps:

  • Add 1 to the top stack element (at start it is an implicit 0)
  • Duplicate top stack element
  • Pop and output the top of the stack as number and a newline
  • Wrap around to step 1 as we reached the end of the line

randomra

Posted 2015-11-14T12:40:24.093

Reputation: 19 909

21

Marbelous, 11450 4632 bytes

Printing decimals is a pain!!

Definitely not winning with this one, but I thought I'd give it a shot. I hope it's ok that it pads the output to 40 zeros (to fit 2^128).

00@0..@1..@2..@3..@4..@5..@6..@7..@8..@9..@A..@B..@C..@D..@E..@F..@G..@H..@I..@J
\\++..00..00..00..00..00..00..00..00..00..00..00..00..00..00..00..00..00..00..00
..EhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhunEhun
....AddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddtAddt
..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7..&7\/
../\&8..........................................................................
....@0..........................................................................
....../\&8......................................................................
....//..@1......................................................................
........../\&8..................................................................
......////..@2..................................................................
............../\&8..............................................................
........//////..@3..............................................................
................../\&8..........................................................
..........////////..@4..........................................................
....................../\&8......................................................
............//////////..@5......................................................
........................../\&8..................................................
..............////////////..@6..................................................
............................../\&8..............................................
................//////////////..@7..............................................
................................../\&8..........................................
..................////////////////..@8..........................................
....................................../\&8......................................
....................//////////////////..@9......................................
........................................../\&8..................................
......................////////////////////..@A..................................
............................................../\&8..............................
........................//////////////////////..@B..............................
................................................../\&8..........................
..........................////////////////////////..@C..........................
....................................................../\&8......................
............................//////////////////////////..@D......................
........................................................../\&8..................
..............................////////////////////////////..@E..................
............................................................../\&8..............
................................//////////////////////////////..@F..............
................................................................../\&8..........
..................................////////////////////////////////..@G..........
....................................................................../\&8......
....................................//////////////////////////////////..@H......
........................................................................../\&8..
......................................////////////////////////////////////..@I..
............................................................................../\&8
........................................//////////////////////////////////////..@J
&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9&9
Sixteenbytedecimalprintermodulewitharegi

:Sixteenbytedecimalprintermodulewitharegi
}J}J}I}I}H}H}G}G}F}F}E}E}D}D}C}C}B}B}A}A}9}9}8}8}7}7}6}6}5}5}4}4}3}3}2}2}1}1}0}00A
/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A/A%A
%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..%A..
+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O..
+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O+O..

:/A
..}0..}0..
..>>}0....
..>>>>\\..
....//..//
../\>>\\..
....>>..//
....>>\\..
....>>....
\\>>//....
..>>......
..>>......
../\......
..../\<<..
......<<..
..\\<<//..
....~~....
....++....
....\\..//
\\....>9\/
..\\..?0..
......++..
....\\....
......{0..

:%A
@0..
}0..
<A-A
{0@0

:Eg
}0}0}0}0}0}0}0}0
^7^6^5^4^3^2^1^0
~~....~~~~..~~~~
^0^0^0^0^0^0^0^0
{0{0{0{0{0{0{0{0

:Ehun
}0..}0
Eg..&0
=8&0{0
&1\/00
0100&0
&1&1{1
{1{0

:Addt
}0}1
{1{1

TheDoctor

Posted 2015-11-14T12:40:24.093

Reputation: 7 793

Would printing binary be any shorter? – SuperJedi224 – 2015-11-14T20:15:46.890

3(or what about unary?) – Doorknob – 2015-11-14T21:58:13.193

@Doorknob displaying the output isn't the problem. It's something on the Ehun board that is supposed to increment the next digit, but doesn't work properly – TheDoctor – 2015-11-14T21:59:35.410

1Did you know you can leave out the periods at the end of every line and blank lines between boards and use single characters for board names? You just have to repeat that single character the appropriate amount of time to call upon it. This can get your answer down to about 3000 bytes. – overactor – 2015-12-30T08:53:46.303

Eventually I'm going to push a commit to marbelous.py that includes all of include/ by default – Sparr – 2019-02-06T02:55:28.047

20

C (64-bit architecture only), 53 bytes

Relies on pointers being at least 64 bits and prints them in hex using the %p specifier. The program would return right when it hits 2^128.

char*a,*b;main(){for(;++b||++a;)printf("%p%p ",a,b);}

feersum

Posted 2015-11-14T12:40:24.093

Reputation: 29 566

1So if those pointers are at each 64 bit, you could only count to 2^128-1, right? – flawr – 2015-11-14T14:15:31.647

@flawr Correct. – feersum – 2015-11-14T14:16:29.093

1This seems not really to meet the goal of the challenge: To master the difficulty of having to circumvent any types such as int and long. – flawr – 2015-11-14T14:19:10.873

@flawr The goal of code golf is to accomplish the task in fewest bytes, not in the way that makes it most difficult for yourself. – feersum – 2015-11-14T14:20:01.833

1But it should still meet the specs, but it seems I am the only one who sees it that way. – flawr – 2015-11-14T14:29:26.643

6Invalid as it can't count up to 2^128 – edc65 – 2015-11-14T14:52:51.120

1@edc65 The spec says until 2^128, which is not inclusive. – feersum – 2015-11-14T15:05:17.940

2This overcomes my english language abilities. If feel it's inclusive but I could be wrong. – edc65 – 2015-11-14T15:07:20.320

Until can be either inclusive or exclusive, apparently. – SuperJedi224 – 2015-11-14T17:17:14.413

@edc65 I just edited the question to fix the ambiguity for you. – SuperJedi224 – 2015-11-14T17:25:32.233

15I like CodeGolf when it is about expressing and rewarding creativity. feersum is clearly not competing for the win here. To see many downvotes on a technicality and to modify the wording of the question to make sure his answer is in violation makes me sad. – flodel – 2015-11-14T17:44:55.490

3I thought the words "at least as far as 2^128" were clear enough... – vrwim – 2015-11-14T18:00:30.750

6@vrwim You didn't write that. You wrote "until 2^128". SuperJedi edited it a few minutes ago. – feersum – 2015-11-14T18:07:57.190

17

Hexagony, 12 11 10 7 bytes

Thanks to alephalpha for fitting the code into side-length 2.

10})!';

Unfolded:

 1 0
} ) !
 ' ;

This one is fairly simple. 10 writes a 10, i.e. a linefeed to the initial memory edge. Then })!'; is repeatedly executed in a loop:

  • } move to the next memory edge.
  • ) increment it.
  • ! print it as an integer.
  • ' move back to the 10.
  • ; print it as a character.

I believe that this is optimal (although by far not unique). I've let the brute force script I wrote for this answer search for 6-byte solutions under the assumption that it would have to contain at least one each of ; and ! and either ( or ), and would not contain ?, , or @, and it didn't find any solutions.

Martin Ender

Posted 2015-11-14T12:40:24.093

Reputation: 184 808

13

Pyth, 4 bytes

.V1b

Explanation:

.V1    for b in range(1 to infinity):
   b      print b

Jakube

Posted 2015-11-14T12:40:24.093

Reputation: 21 462

f!\n (TIO link) will work for 3 bytes, not sure if that's using any features that have been added after your answer though. – Sok – 2019-07-12T14:03:23.233

@Sok Clever. However, I won't change the answer because I think that f was a feature oft Pyth 4 years ago. – Jakube – 2019-07-12T15:23:33.347

I thought so too, which is why I left it as a comment - new language features to beat an older answer always feel cheap IMO – Sok – 2019-07-12T16:51:37.183

13

bc, 10

for(;;)++i

Unusual that bc is shorter than dc.

From man bc:

DESCRIPTION

bc is a language that supports arbitrary precision numbers

Digital Trauma

Posted 2015-11-14T12:40:24.093

Reputation: 64 644

Where does this print it out? – Bálint – 2016-04-24T07:47:40.970

@Bálint ++i is an expression, but not an assignment, and is therefor explicitly output. Did you try running it? echo 'for(;;)++i' | bc in your nearest Linux terminal. – Digital Trauma – 2016-04-24T07:52:43.180

I don't have a single Linux terminal in my house. I was just curious. – Bálint – 2016-04-24T08:04:12.033

7@Bálint Every house should have a Linux terminal. – Digital Trauma – 2016-04-24T08:09:14.673

I have no use for them :P – Bálint – 2016-04-24T09:23:55.940

1@Bálint Running this program is your use ;) – Insane – 2016-04-24T18:32:04.060

Or I can press F12, and enter the for(i=0;;) console.log(i++) code, and I don't even need to install a separate OS for kt. – Bálint – 2016-04-24T20:04:03.863

@Bálint : I wanted also to confirm. If it is also your desire, you can go to https://www.tutorialspoint.com/execute_ksh_online.php . Then in the green area enter bc and after enter the code pasted from here.

– sergiol – 2017-02-03T17:52:30.690

@Bálint There is ALWAYS a use for a linux terminal... :) – Mega Man – 2017-04-23T17:06:52.853

12

Java, 139 138 127 123 bytes

class K{public static void main(String[]a){java.math.BigInteger b=null;for(b=b.ZERO;;)System.out.println(b=b.add(b.ONE));}}

SuperJedi224

Posted 2015-11-14T12:40:24.093

Reputation: 11 342

2A smaller infinite loop in java is for(;;) for an easy 3 bytes. – ankh-morpork – 2015-11-14T17:29:08.860

You can also save another 2 with BigInteger b=null;b=b.ZERO;, sadly the =null is needed, even thought it's a static access. – TWiStErRob – 2015-11-14T19:46:52.017

And then another 9, because you can get rid of the import by referencing BigInteger by FQCN only once. – TWiStErRob – 2015-11-14T19:47:31.013

@TWiStErRob Somehow, I hadn't realized that would be shorter. – SuperJedi224 – 2015-11-14T20:05:57.847

Me neither, I wanted to suggest BigInteger b;b=b.ZERO;, but then it didn't compile... :( that null is a little silly. – TWiStErRob – 2015-11-14T20:07:00.573

Whoa, I didn't know you can put void into for's first and third "argument", thanks! :) – TWiStErRob – 2015-11-14T20:14:03.410

@TWiStErRob Essentially any single statement can go in either of those places – SuperJedi224 – 2015-11-14T20:33:30.053

could you not java.math.BigInteger b;b=b.ZERO;for(b;;) and as it currently stand surely your b=b.ZERO is setting on every loop so you would only show 1 infinitely? – Martin Barker – 2016-04-25T14:52:38.013

@MartinBarker The first statement there is only executed once as that's how for loops work – SuperJedi224 – 2016-04-25T18:10:03.933

2For Java 8 or newer, you can replace the class with interface and remove public from the function. Don't wanna copy your code and post it as a new answer. – Luca H – 2017-11-24T06:55:12.250

10

Mathematica, 22 bytes

i=0;While[Echo[++i]>0]

Echo is a new function in Mathematica 10.3.

alephalpha

Posted 2015-11-14T12:40:24.093

Reputation: 23 988

Echo gives four separating characters: newline plus ">> ". Not sure this is valid – maybe use Print instead? Also, save a byte with i=0;While[Echo@++i>0]. – Roman – 2019-07-14T18:08:37.200

7

Python 3, 33 25 bytes

As far as I understand, Pythons integers are arbitrary precision, and print() automatically produces newlines.

Thanks for @Jakub and @Sp3000 and @wnnmaw! I really don't know much python, the only think I knew was that it supports arbitrary size integers=)

k=1
while 1:print(k);k+=1

flawr

Posted 2015-11-14T12:40:24.093

Reputation: 40 560

1 is a truthy value in Python (and most other languages). So while 1: is enough. – Jakube – 2015-11-14T12:49:17.837

Also, you can put the whole while on one line – Sp3000 – 2015-11-14T12:51:04.487

You can save a byte by using repr(k) rather than print(k). Also, I count your byte size as 25 (without my suggested change)

– wnnmaw – 2015-11-16T21:00:23.297

1You can not use repr instead of print. repr does not output anything. @wnnmaw – Zach Gates – 2015-11-17T19:47:58.950

What does repr do then? – flawr – 2015-11-17T19:52:16.520

@flawr It converts the object to a string, much like str does. That only will print in a REPL environment (therefore making it a snippet, and not allowed by the rules), but if you were going to assume that you would just leave the integer object alone instead of calling repr. Also I believe repr will append an L to the numbers once they get big enough. – FryAmTheEggman – 2015-11-19T16:51:20.470

Doesn't while k++: ... work? (I don't know Python, just wondering – Charlie – 2016-02-26T08:31:13.460

@Charlie Python unfortunately does not have the ++ increment, that is why=) – flawr – 2016-02-26T08:38:03.053

you can reduce 1 more byte by making it Python 2 and making it print k – Koishore Roy – 2017-07-19T20:07:57.737

7

Ruby, 15 12 bytes

loop{p$.+=1}
  • p, when given an integer, prints the integer as-is (courtesy of @philomory)
  • $. is a magical variable holding the number of lines read from stdin. It is obviously initialized to 0, and also assignable :)

daniero

Posted 2015-11-14T12:40:24.093

Reputation: 17 193

@philomory It is typically suggested for users to leave a comment suggesting their byte-saving solution. Also, I'd like to see an explanation for this one. c: – Addison Crump – 2015-11-15T20:26:34.510

6

Processing, 95 85 71 bytes

java.math.BigInteger i;{i=i.ZERO;}void draw(){println(i=i.add(i.ONE));}

I tried something with a while loop but it causes all of Processing to crash, so I'll stick with this for now.

(Thanks to @SuperJedi224 and @TWiStErRob for suggestions.)

geokavel

Posted 2015-11-14T12:40:24.093

Reputation: 6 352

What's with the spaces? I'm pretty sure import java.math.*;BigInteger i=BigInteger.ZERO;void draw(){println(i=i.add(BigInteger.ONE));} will work. – SuperJedi224 – 2015-11-14T15:55:38.300

Yeah, just fixed that. – geokavel – 2015-11-14T15:56:30.967

Does Processing allow the BigInteger.ONE to be changed toi.ONE? – SuperJedi224 – 2015-11-14T16:05:26.617

@SuperJedi224 Yes, it does. Thanks! – geokavel – 2015-11-14T16:16:24.183

Alright, have an upvote. – SuperJedi224 – 2015-11-14T16:28:01.703

See http://codegolf.stackexchange.com/a/63850/32436 for shortening tips.

– TWiStErRob – 2015-11-14T20:08:18.267

@TWiStErRob I had to add setup() to get it to work, so it only ends up saving 2 bytes, but it looks nicer (and more Processing-y)! Interestingly, setting i=null initially is not required in Processing. – geokavel – 2015-11-14T20:28:33.753

You don't need =null, because i is a field in your case, not a local variable and those are auto-initialized with default values. – TWiStErRob – 2015-11-14T20:30:05.130

Try removing void setup(), but leave the braces, because it may support object initializer blocks from Java. – TWiStErRob – 2015-11-14T20:30:15.973

@TWiStErRob Wow, it works! Thank you! – geokavel – 2015-11-14T20:32:57.490

6

JavaScript (ES6), 99 94 67 bytes

for(n=[i=0];;)(n[i]=-~n[i++]%10)&&alert([...n].reverse(i=0).join``)

alert is the generally accepted STDOUT equivalent for JavaScript but using it means that consecutive numbers are automatically separated. I've assumed that outputting a character after the number is not necessary because of this.

user81655

Posted 2015-11-14T12:40:24.093

Reputation: 10 181

12This is why I have a pop-up blocker. – Comintern – 2015-11-14T16:47:57.367

1just saying:

for(i=0;;)alert(i++)

I don't think you need all of those controls – towc – 2015-12-30T13:47:54.973

3@towc That won't work. All numbers are 64 bit floats in JavaScript which have a maximum safe integer value of 2^53 but the question requires it to go up to 2^128. – user81655 – 2015-12-30T13:53:08.123

1oh, fair point... – towc – 2015-12-30T14:00:24.193

6

Samau, 2 bytes

N)

Explanation:

N     push the infinite list [0 1 2 ...] onto the stack
 )    increase by 1

When the output of a program is a list, the outmost brackets are omitted.

alephalpha

Posted 2015-11-14T12:40:24.093

Reputation: 23 988

Doesn't a list print all its contents at once? If this list is infinite, then it cannot possibly fit in memory or on your screen, and it will never stop being generated, so it will never be printed.

– cat – 2015-12-29T15:58:29.040

1

@cat Samau is written in Haskell, and it's lazy. It won't generate the whole list before printing it.

– alephalpha – 2015-12-30T02:48:55.870

Just a heads up. On the GitHub page for Samau, in the description of @, "push" is misspelt. – Carcigenicate – 2017-03-31T22:39:51.720

@Carcigenicate Thank you. – alephalpha – 2017-04-01T04:10:54.453

5

Matlab, 132 bytes

a=0;while 1;b=a==9;n=find(cumsum(b)-(1:numel(b)),1);a(n)=a(n)+1;a(1:n-1)=0;if ~numel(n);a=[0*a,1];end;disp([a(end:-1:1)+'0','']);end

Ok, I think this is the first serious answer that accomplishes this task without a trivial builtin abitrary size integer. This program implements an arbitrary size integer as an array of integers. Each integer is always between 0 and 9, so each array element represents one decimal digit. The array size wil be increased by one as soon as we are at e.g. 999. The memory size is no problem here, as 2^128 only requires an array of length 39.

a=0;
while 1
    b=a==9;
    %first number that is not maxed out
    n=find(cumsum(b)-(1:numel(b)),1);
    %increase that number, and sett all maxed out numbers to zero
    a(n)=a(n)+1; 
    a(1:n-1)=0;
    if ~numel(n) %if we maxed out all entries, add another digit
        a=[0*a,1];
    end    
    disp([a(end:-1:1)+'0',''])%print all digits
end

flawr

Posted 2015-11-14T12:40:24.093

Reputation: 40 560

5

C++, 146 141 138 bytes

Using a standard bigint library is perhaps the most boring way of answering this question, but someone had to do it.

#include<stdio.h>
#include<boost/multiprecision/cpp_int.hpp>
int main(){for(boost::multiprecision::uint512_t i=1;;){printf("%u\n",i++);}}

Ungolfed:

#include<cstdio>
#include<boost/multiprecision/cpp_int.hpp>

int main()
{
    for(boost::multiprecision::uint512_t i=1;;)
    {
        std::printf("%u\n", i++);
    }
}

The reason the golfed version uses stdio.h and not cstdio is to avoid having to use the std:: namespace.

This is my first time golfing in C++, let me know if there's any tricks to shorten this further.

felixphew

Posted 2015-11-14T12:40:24.093

Reputation: 321

Maybe you could use '\n' instead of std::endl, would save you 8 bytes. Also there may be a way to use CPP #define to compress some repetition, – Kenney – 2015-11-15T02:23:07.163

@Kenney Thank you for that! (It only saves 5 bytes, not 8.) I think I may have come up with a way to tweak that section even shorter, though. – felixphew – 2015-11-15T03:50:30.067

I do not knoww boost (and I would not say it is standard either) but isn't i defaultly constructed with the value of 0? You could then strip off definition and switch postincrement to preincremet which would save 2b – Zereges – 2015-11-22T20:52:13.170

How about the deprecated #import? – connectyourcharger – 2019-07-03T20:35:53.470

5

C# .NET 4.0, 111 103 102 97 bytes

class C{static void Main(){System.Numerics.BigInteger b=1;for(;;)System.Console.WriteLine(b++);}}

I didn't find any C# answer here, so I just had to write one.

.NET 4.0 is required, because it's the first version that includes BigInteger. You have to reference System.Numerics.dll though.

With indentation:

class C
{
    static void Main()
    {   
        System.Numerics.BigInteger b = 1;
        for (;;)
            System.Console.WriteLine(b++);
    }
}

Thanks to sweerpotato, Kvam, Berend for saving some bytes

Kazarp

Posted 2015-11-14T12:40:24.093

Reputation: 151

You can save 8 bytes with class C{static void Main(){var b=System.Numerics.BigInteger.One;for(;;)System.Console.WriteLine(b++);}} :~)! – sweerpotato – 2015-11-15T11:16:30.320

1Move declaration of b and Console.WriteLine into the loop structure: class C{static void Main(){for(var b=System.Numerics.BigInteger.One;;Console.WriteLine(b++));}} – Kvam – 2015-11-15T12:09:01.513

You still need System. That saves one byte though! – sweerpotato – 2015-11-15T12:12:47.250

Yeah, you're right. – Kvam – 2015-11-15T12:13:04.697

If you add using System; (13 bytes) you can do away with the System. (7 bytes) twice, saving 1 byte. – Kenney – 2015-11-15T18:46:07.290

I always thought .net and java would be out of code golf since you have to have the frameworks for them to run. Do the rules (for CG in general) say that the score is determined only by the program proper, excluding the framework? – gregsdennis – 2015-11-15T20:40:25.313

@Kenney I've already tried this, but you can't use simply Numerics.BigIntegerwhen you have using System;. You must use using System.Numerics;. So it doesn't save anything – Kazarp – 2015-11-16T08:40:38.193

Shave off 5 more bytes by not using BigInteger.One and getting rid of var: class C{static void Main(){System.Numerics.BigInteger b=1;for(;;)System.Console.WriteLine(b++);}} – Berend – 2015-11-16T09:52:52.973

You could make this 77 with the following class C{static void Main(){var i=0m;for(;;){System.Console.WriteLine(i++);}}} and works on .Net 2.0 – Johan – 2015-11-16T11:57:23.370

@Johan The maximum value for a decimal is 79,228,162,514,264,337,593,543,950,335 which is smaller than 2^128. – Berend – 2015-11-17T09:08:32.330

@Berend yip, realized that later... by a difference of a lot :( – Johan – 2015-11-17T10:17:30.380

You don't need another ;, write class C{static void Main(){for(System.Numerics.BigInteger b=1;;System.Console.WriteLine(b++));}} instead, which saves one byte from the solution in the answer at the time of writing. – Theraot – 2017-05-27T15:32:47.087

5

Clojure, 17 bytes

(map prn (range))

Lazy sequences and arbitrary precision integers make this easy (as for Haskell and CL). prn saves me a few bytes since I don't need to print a format string. doseq would probably be more idiomatic since here we're only dealing with side effects; map doesn't make a lot of sense to use since it will create a sequence of nil (which is the return value of each prn call.

Assuming I count forever, the null pointer sequence which results from this operation never gets returned.

MONODA43

Posted 2015-11-14T12:40:24.093

Reputation: 131

4

MarioLANG, 11 bytes

+<
:"
>!
=#

Inspired by Martin Büttner's answer in another question.

alephalpha

Posted 2015-11-14T12:40:24.093

Reputation: 23 988

Are you sure this works without problems to 2^128? – flawr – 2015-11-14T13:55:01.813

1This looks familiar. :) – Martin Ender – 2015-11-14T14:00:54.120

@flawr MarioLANG has a Ruby interpreter, and Ruby's integer type has arbitrary precision. – Martin Ender – 2015-11-14T14:01:15.383

@flawr It depends on the interpreter. The interpreter I'm using is written in Ruby, and it supports arbitrary precision. – alephalpha – 2015-11-14T14:02:54.223

4

CJam, 7 bytes

0{)_p}h

Explanation:

0         e# Push a zero to the stack
 {        e# Start a block
  )         e# Increment top of stack
   _        e# Duplicate top of stack
    p       e# Print top of stack
     }    e# End block
      h   e# Do-while loop that leaves the condition on the stack

Note: Must use Java interpreter.

GamrCorps

Posted 2015-11-14T12:40:24.093

Reputation: 7 058

4

C, 89 bytes

A new approach (implementing a bitwise incrementer) in C:

b[999],c,i;main(){for(;;)for(i=c=0,puts(b);i++<998;)putchar(48+(c?b[i]:(b[i]=c=!b[i])));}

Less golfed

int b[999], c, i;
main() {
  for(;;)
    for(i=c=0, puts(b); i++ < 998;)
      putchar(48 + (c ? b[i] : (b[i] = c = !b[i])));
}

Terminate

This version has the slight flaw, that it does not terminate (which isn't a requirement at the moment). To do this you would have to add 3 characters:

b[129],c=1,i;main(){for(;c;)for(i=c=0,puts(b);i++<128;)putchar(48+(c?b[i]:(b[i]=c=!b[i])));}

Helco

Posted 2015-11-14T12:40:24.093

Reputation: 148

4In fact it should not terminate. That's the meaning of forever – edc65 – 2015-11-14T17:55:21.597

4

BotEngine, 128 120 112 8x13=104

v2 2 01
>e>S SS
   e1e1
   e2 e0 12
   > > S SS P
  ^   <e0e1 R
     ^ < <lC^
^         <

Output is in binary.

SuperJedi224

Posted 2015-11-14T12:40:24.093

Reputation: 11 342

4

Foo, 6 bytes

(+1$i)

Explanation

(    )    Loop
 +1       Add one to current element
   $i     Output current element as a decimal integer

Zach Gates

Posted 2015-11-14T12:40:24.093

Reputation: 6 152

4

Minkolang, 4 bytes

1+dN

Try it here. (Well, actually, be careful. 3 seconds of run time was enough to get up to ~40,000.)

1+ adds 1 to the top of stack, d duplicates it, and N outputs the top of stack as an integer with a trailing space. This loops because Minkolang is toroidal, so when the program counter goes off the right edge, it reappears on the left.

El'endia Starman

Posted 2015-11-14T12:40:24.093

Reputation: 14 504

4

Perl, 34 32 30 28 26 23 bytes

-Mbigint -E '{say$_+=1;redo}'

Test with

perl -Mbigint -E '{say$_+=1;redo}'

Kenney

Posted 2015-11-14T12:40:24.093

Reputation: 946

You can replace for(,,){...} with {...;redo} for two. – primo – 2015-11-15T00:14:24.870

Yes I saw (perl 5.18+), but I thought it might be cheating; then the answers would be the same. I'm new here, so ;-) – Kenney – 2015-11-15T00:23:13.127

I've since deleted mine - I didn't see yours until after posting. You could also require -lMbigint, rather than use bigint and $/. The example scoring seems to implicitly allow it. – primo – 2015-11-15T02:09:24.773

The -l automatically appends $/ to each print statement. You do, however, need to include -lMbigint in the byte count ;) – primo – 2015-11-15T02:33:42.407

If you used -E instead of -e then you could use say instead of using $/. perl -Mbigint -E '{say++$i;redo}' 14+7=21 which works back to 5.10 released 2007-Dec-18 – Brad Gilbert b2gills – 2015-11-15T17:44:06.323

@Brad thanks! I knew about say but not that -E would use v5.10. I'm not quite sure how to count -Mbigint -E and the ', - and spaces, so I've kept a pessimistic count. 21 bytes would be great, though! – Kenney – 2015-11-15T18:13:41.287

Since you have to use -e or -E I don't think it counts. Also the quoting characters don't count as that is an artifact of the shell not Perl. – Brad Gilbert b2gills – 2015-11-15T18:21:16.160

I think you will need to use $i+=1, as ++$i will result in a floating point number (test with -Mbigint -E '{say++$i;$i+=$i;redo}'). For scoring, I would score -Mbigint -E '{say$i+=1;redo}' as 23: Mbigint as 7, E as 1, and {say$i+=1;redo} as 15 (in essence, I count MbigintE{say$i+=1;redo}). – primo – 2015-11-16T11:32:02.377

@primo Thanks - how odd that an integer increment makes for a float, didn't know that! – Kenney – 2015-11-16T13:24:55.830

1Scalar references will be auto-vivified as SV UNDEF, which when incremented won't trigger the BigInt overload - because it's not a BigInt. Integer literals, however, are created as BigInts. Not so odd really ;) – primo – 2015-11-16T16:13:05.850

1Could you use $- to keep it as an integer and return to using ++$-? – Dom Hastings – 2015-11-24T07:39:40.250

1@DomHastings I tested with perl -Mbigint -E '{say++$-;$-+=$-;redo}' | more and it wraps around to 1. It stays an int but bigint doesn't step in, unfortunately. – Kenney – 2015-11-24T11:17:42.790

@Kenney Damn, oh well! – Dom Hastings – 2015-11-24T16:34:23.687

4

Intel 8086+ Assembly, 19 bytes

68 00 b8 1f b9 08 00 31 ff f9 83 15 00 47 47 e2 f9 eb f1

Here's a breakdown:

68 00 b8                push   0xb800             # CGA video memory
1f                      pop    ds                 # data segment
b9 08 00           L1:  mov    cx, 8              # loop count
31 ff                   xor    di, di             # ds:di = address of number
f9                      stc                       # set carry
83 15 00           L2:  adc    word ptr [di], 0   # add with carry
47                      inc    di
47                      inc    di
e2 f9                   loop   L2
eb f1                   jmp    L1

It outputs the 128 bit number on the top-left 8 screen positions. Each screen position holds a 8-bit ASCII character and two 4 bit colors.

Note: it wraps around at 2128; simply change the 8 inmov cx, 8 to 9 to show a 144 bit number, or even 80*25 to show numbers up to 232000.

Running

1.44Mb bzip2 compressed, base64 encoded bootable floppy Image

Generate the floppy image by copy-pasting the following

QlpoOTFBWSZTWX9j1uwALTNvecBAAgCgAACAAgAAQAgAQAAAEABgEEggKKAAVDKGgAaZBFSMJgQa
fPsBBBFMciogikZcWgKIIprHJDS9ZFh2kUZ3QgggEEh/i7kinChIP7HrdgA=

into this commandline:

base64 -d | bunzip2 > floppy.img

and run with, for instance, qemu -fda floppy.img -boot a

1.8Mb bootable ISO

This is a base64 encoded bzip2 compressed ISO image. Generate the iso by pasting

QlpoOTFBWSZTWZxLYpUAAMN/2//fp/3WY/+oP//f4LvnjARo5AAQAGkAEBBKoijAApcDbNgWGgqa
mmyQPU0HqGCZDQB6mQ0wTQ0ZADQaAMmTaQBqekyEEwQaFA0AA0AxBoAAA9Q0GgNAGg40NDQ0A0Bi
BoDIAANNAA0AyAAABhFJNIJiPSmnpMQDJpp6nqeo0ZDQaAANB6IA0NAGj1EfIBbtMewRV0acjr8u
b8yz7cCM6gUUEbDKcCdYh4IIu9C6EIBehb8FVUgEtMIAuvACCiO7l2C0KFaFVABcpglEDCLmQqCA
LTCAQ5EgnwJLyfntUzNzcooggr6EnTje1SsFYLFNW/k+2BFABdH4c4vMy1et4ZjYii1FbDgpCcGl
mhZtl6zX+ky2GDOu3anJB0YtOv04YISUQ0JshGzAZ/3kORdb6BkTDZiYdBAoztZA1N3W0LJhITAI
2kSalUBQh60i3flrmBh7xv4TCMEHTIOM8lIurifMNJ2aXr0QUuLDvv6b9HkTQbKYVSohRPsTOGHi
isDdB+cODOsdh31Vy4bZL6mnTAVvQyMO08VoYYcRDC4nUaGGT7rpZy+J6ZxRb1b4lfdhtDmNwuzl
E3bZGU3JTdLNz1uEiRjud6oZ5kAwqwhYDok9xaVgf0m5jV4mmGcEagviVntDZOKGJeLjyY4ounyN
CWXXWpBPcwSfNOKm8yid4CuocONE1mNqbd1NtFQ9z9YLg2cSsGQV5G3EhhMXKLVC2c9qlqwLRlw4
8pp2QkMAMIhSZaSMS4hGb8Bgyrf4LMM5Su9ZnKoqELyQTaMAlqyQ3lzY7i6kjaGsHyAndc4iKVym
SEMxZGG8xOOOBmtNNiLOFECKHzEU2hJF7GERK8QuCekBUBdCCVx4SDO0x/vxSNk8gKrZg/o7UQ33
Fg0ad37mh/buZAbhiCIAeeDwUYjrZGV0GECBAr4QVYaP0PxP1TQZJjwT/EynlkfyKI6MWK/Gxf3H
V2MdlUQAWgx9z/i7kinChITiWxSo

into

base64 -d bunzip2 > cdrom.iso

and configure a virtual machine to boot from it.

DOS .COM

This is a base64 encoded DOS .COM executable:

aAC4H7kIADH/+YMVAEdH4vnr8Q==

Generate a .COM file using

/bin/echo -n aAC4H7kIADH/+YMVAEdH4vnr8Q== | base64 -d > COUNTUP.COM

and run it in (Free)DOS.

Kenney

Posted 2015-11-14T12:40:24.093

Reputation: 946

4

Marbelous, 358 bytes

..@F..@E..@D..@C..@B..@A..@9..@8..@7..@6..@5..@4..@3..@2..@1..@001@Z01
..AddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddoAddo/\&I
00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I00&I....@Z
@FHd@EHd@DHd@CHd@BHd@AHd@9Hd@8Hd@7Hd@6Hd@5Hd@4Hd@3Hd@2Hd@1Hd@0Hd
0A@N
..&I
@N/\..
:Hd
}0
Hp
}0
..
{<
#include hex_out.mbl
#include arithmetic.mbl

16 half adders chained together, the rightmost one performing N++ each cycle and each adder feeding its overflow (00 or 01) to the next in the chain. Output is in hex.

The python interpreter has a bug where output from memoized functions is lost, so you have to run this with "-m 0" to make it work right. Without that parameter you can see how fast it will run without the bug, but the output won't work right.

Note to self: fix that bug in marbelous.py This bug has been fixed in the latest version of marbelous.py

Sparr

Posted 2015-11-14T12:40:24.093

Reputation: 5 758

4

R, 52 Bytes

a=gmp::as.bigz(1);repeat{cat(paste(a,""));a=a+1}

(Note: gmp is an external library, so you may have to download it for this solution to work)

SnoringFrog

Posted 2015-11-14T12:40:24.093

Reputation: 1 709

1+1 ... sorry about all the extras. To get you a couple back you could try a=gmp::as.bigz(0);repeat{cat(paste(a<-a+1,''))}. You may want to make a note that gmp is an external library that may need downloading. – MickyT – 2015-11-18T22:10:33.243

44 bytes :) – Giuseppe – 2018-01-18T14:19:14.073

4

05AB1E, 4 bytes

[¼¾,

Explained

[           # start infinite loop
 ¼          # increase counter
  ¾         # push counter
   ,        # print with a newline

Emigna

Posted 2015-11-14T12:40:24.093

Reputation: 50 798

1ASCII-only version: [N>, – Erik the Outgolfer – 2017-08-22T15:12:38.250

Another 4-bytes alternative: 0[>= – Kevin Cruijssen – 2019-03-05T14:21:04.530

3

Chip, 2214 bytes

Noncompeting: this uses language features that post-date the challenge. For a competing entry that is too inefficient to run, see the edit history.

2211 bytes for the code, plus 3 bytes for the -w flag.

o z*
`K\' ,--K   ,--K   ,--K   ,--K   ,--K   ,--K   ,--K8  ,--K   ,--K   ,--K   ,--K   ,--K   ,--K   ,--K   ,--K
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o
o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o | o#-o,' o#-o
 `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `---'  `--'
=
o-----)-------------------------------------------------------------------------------------------------.
`z--z------z------z------z------z------z------z------z------z------z------z------z------z------z------z-K----.
o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a o-zo/a
oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b oz-o/b
o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c o-zo/c
oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d oz-o/d
o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e o-zo/e
oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f oz-o/f
o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g o-zo/g
oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h oz-o/h

This solution gives output in 128 bits / 16 bytes, big endian. It has two main sections, one for incrementing, and the other for timing, storage, and output. There is likely a smaller implementation out there, but I haven't yet conceived of it.

Try it online for the 128-bit version.
Try it online for the 16-bit version, much faster than the 128 bit version.

Notes about the TIO: The -v flag is included, which shows the actual incoming/outgoing binary on stderr. In the TIO, we also provide a -cN flag, which cuts off the program after N bytes have been produced.

Explanation

Chip is a (mostly) 2D language that operates on individual bits, which is why it needs a lot of space for 128-bit support. I won't get into the specific details (because we'd be here all day), but here's the gist of what's going on:

  • Layers:
    =
    This is a layer divider. Lines above form the first layer, lines below form the second. Wherever there are o's on both layers, a connection is formed.
  • Incrementing:
     K   ,--
    o#-o |
    o#-o |
    o#-o |
    o#-o |
    o#-o |
    o#-o |
    o#-o |
    o#-o |
     `---'
    Each # is a half-adder, and each column of # serves to increment the eight inputs on the left to the eight outputs on the right. The K at the top is a caching element to help with call stack efficiency. The tail is a wire to bring the carry back up to the next incrementor. There are sixteen such incrementors, for the sixteen bytes required to produce 128 bits. The 8 seen near the eighth incrementor is used for cache priming. This element is always the first element polled each cycle, and so it primes all caches to it's left. This prevents a stack overflow when we eventually compute the values to the right.
  • Storage:
    o-zo
    oz-o
    o-zo
    oz-o
    o-zo
    oz-o
    o-zo
    oz-o
    Each z reads a signal in on its top/right, and outputs that signal to the bottom/left. Therefore, these columns act as registers to hold the current state for the next cycle to use. The z's are offset from each other to prevent cross-talk. Again, sixteen such columns, one per byte.
  • Output:
    o/a
    o/b
    o/c
    o/d
    o/e
    o/f
    o/g
    o/h
    The letters a through h correspond to each of the bits of the byte that will be output, with a being the least signficant bit. The columns of /'s are switches that interact with the timing circuit to determine which byte is due to be output. Once more, sixteen columns, one per byte.
  • Timing:
    o z*
    `v\'
    o-------------
    `z--z------z--
    The timing circuit consists of two parts. The portion on the first layer produces a high signal on the first clock tick only (to get it all started) and connects the rest of the timing circuit to the incrementors (increments by 1 only every 16th tick, increments by 0 otherwise). The portion on the second layer controls the actual sequencing. The pattern is to increment the value and output the highest byte, then output each successive byte without incrementing anything. When all bytes have been printed, the cycle repeats. (There is a cache element K and an or-gate ) that acts as a diode; these are again for efficiency only.)

Phlarx

Posted 2015-11-14T12:40:24.093

Reputation: 1 366

3

Alice, 6 bytes

h .\
O

Try it online!

Alice is a 2D language with two modes - Cardinal (up/down/left/right) for integers and Ordinal (diagonal) for strings. For this challenge we need Cardinal to count and Ordinal to print as an integer (as opposed to a byte).

We start off from the top left in Cardinal mode, with h incrementing the top of stack — for the first iteration, this is an implicit 0. The space that follows is a no-op, and the . after duplicates the top of stack.

Next we pass through the mirror \, reflecting us NE and switching us to Alice's Ordinal mode. In Ordinal mode the IP reflects off the code boundary rather than wrapping around, so we rebound and start moving SW.

From here we bounce twice, hit the O to print as integer, and bounce back to the \. This switches us back to Cardinal mode moving rightward, wrapping around and continuing the infinite loop.

TL;DR:

0123  ->  h5.3  ->  h7 9  ->  01.9  ->  ...
O         6 4       6 8       O

Sp3000

Posted 2015-11-14T12:40:24.093

Reputation: 58 729

3

ArnoldC, 157 bytes

IT'S SHOWTIME
HEY CHRISTMAS TREE n
YOU SET US UP 0
STICK AROUND 1
GET TO THE CHOPPER n
GET UP 1
ENOUGH TALK
TALK TO THE HAND n
CHILL
YOU HAVE BEEN TERMINATED

First time trying to use ArnoldC so any improvements are welcome. I ran it here and it seemed to work even though the output stops around 1700. I believe this is a limitation of that test though, not the code.

TheLethalCoder

Posted 2015-11-14T12:40:24.093

Reputation: 6 930

3

cQuents, 1 byte

$

Try it online!

Explanation

:    Implicit mode : (infinitely print the sequence if given no input)
 $   Each item in the sequence equals the current (1-based) index

Stephen

Posted 2015-11-14T12:40:24.093

Reputation: 12 293

3

Brainfuck, 1055 bytes

+>+<[>[>[-]+<-]>[<+>>>>>>>>>[-]>[-]<[>+<-]<<<<<<<<-]>>>>>>>>>>>[<<<<<<<<<<<<+>>>>>>>>>>>>-]<<<<<<<<<<<<[>[-]+<-]>[<+>>>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>+>[-]<[>+<-][-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]<<[<<<<<<+>>>>>>-]->>[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>+<<<<<<[-]]<->>>>>>>[<<<<<<<->>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>>>>>>>[>>>>+<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]<[>[-]+<-]>[<+>>>>>>>>>>>>>>+<<<<<<<<<<<<<<->-]>>>>>>>>>>>>[<<<<<<<<<<<<<+>>>>>>>>>>>>>-]<<<<<<<<<<<<<[>[-]+<-]>[<+>>>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>[-]>[-]>[-]>[-]>>>[<<<<+[>+<<<<+>>>-]<<<[>>>+<<<-]+>>>>----------[<<<<->>>>[-]]<<<<[>>+>[-]<<<-]>>[>>+<<<<+>>-]<<[>>+<<-]+>>>>----------[<<<<->>>>[-]]<<<<[>+>[-]<<-]>>>>>>>-]<<<<<<[<++++++++[>++++++>++++++<<-]>.>.[-]<[-]]>[<<++++++++[>>++++++<<-]>>.[-]]<<++++++++[>>>++++++<<<-]>>>.[-]<<<++++[>++++++++<-]>.[-]<>>>>>>>>>>+<<<<<<<<<<<<->-]>>>>>>>>>>>>>[<<<<<<<<<<<<<<+>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<[>[-]+<-]>[<+<->>-]<<]

Too bad that Brainfuck has limited memory cell size. Actually, printing decimals and conditional statements are pain in this language. Ungolfed (or called so):

+>+<[

COUNTER=0

>[>[-]+<-]>[<+

>>>>>>>>>>[-]

LOOP START
    INCREMENTING <<<<<<<<<-]>>>>>>>>>>>[<<<<<<<<<<<<+>>>>>>>>>>>>-]<<<<<<<<<<<<[>[-]+<-]>[<+>>>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>+>[-]<[>+<-]
    CHECKING CELL [-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]<<[<<<<<<+>>>>>>-]->>[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>+<<<<<<[-]]<->>>>>>>[<<<<<<<->>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>>>>>>>[>>>>+<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]<[>[-]+<-]>[<+>>>>>>>>>>>>>>+<<<<<<<<<<<<<<->-]>>>>>>>>>>>>  [<<<<<<<<<<<<<+>>>>>>>>>>>>>-]


    PRINTING
                <<<<<<<<<<<<<[>[-]+<-]>[<+

                PRINT INTEGER

                >>>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>[-]>[-]>[-]>[-]>>>[<<<<+[>+<<<<+>>>-]<<<[>>>+<<<-]+>>>>----------[<<<<->>>>[-]]<<<<[>>+>[-]<<<-]>>[>>+<<<<+>>-]<<[>>+<<-]+>>>>----------[<<<<->>>>[-]]<<<<[>+>[-]<<-]>>>>>>>-]<<<<<<[<++++++++[>++++++>++++++<<-]>.>.[-]<[-]]>[<<++++++++[>>++++++<<-]>>.[-]]<<++++++++[>>>++++++<<<-]>>>.[-]

                PRINT SPACE

                <<<++++[>++++++++<-]>.[-]<


LOOP END

CODE THAT GETS EXECUTED AT THE END (LEAVING LOOP):

>>>>>>>>>>+<<<<<<<<<<<<->-]>>>>>>>>>>>>>[<<<<<<<<<<<<<<+>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<[>[-]+<-]>[<+<->>-]<<]

If we would remove last piece of code it would stick two '1' at the end.

Krzysztof Szewczyk

Posted 2015-11-14T12:40:24.093

Reputation: 3 819

1

Welcome to PPCG! There is already a brainfuck answer here, but multiple answers in the same language are perfectly fine here. Nice answer!

– caird coinheringaahing – 2017-10-24T15:54:35.127

"Printing decimals and conditional statements are a pain in this language." Everything is a pain in brainfuck. That's sort of the point. – KSmarts – 2017-11-17T15:15:22.897

@KSmarts Not really, some things are ridicously easy – Krzysztof Szewczyk – 2017-11-17T19:17:32.197

3

Retina, 13 bytes

+\`^.*
$.(*__

Try it online!

Explanation

Retina 1.0 has a new feature which lets us solve this with an algorithm that conceptually uses a unary representation of the number, but still won't run out of memory. You can test this by initialising the string to a really high number, in that case the program will count from there.

So incrementing decimal numbers isn't really something Retina does, because it only works with strings. Leaky Nun has shown a way to increment decimals, but it's comparably complicated.

What Retina can do with decimal integers is a) repeat a character or string n times and b) measure the length of a string. So the idea is to take the last integer n, generate a string with n+1 characters, and measure its length, and use this as our new result. That's what the code does:

  • ^.* match the current string. We need to use .* instead of .+ because the string is initially empty (the program's input), and ^ because .* would otherwise yield two matches on subsequent iterations.
  • We substitute the match with $.(*__. There is some implicit syntax going on here. The ) is closed implicitly and * has an implicit left-hand operand of $&, so this substitution is really short for $.($&*__). $&*_ generates the string of n underscores (when $& is empty, i.e. on the first iteration, it is treated as zero). The second _ appends another underscore to that, generating a string of n+1 characters. $.(…) measures the length of that string, so we end up with the next integer.
  • \ tells Retina to print the result of this substitution with a trailing linefeed.
  • + runs the entire thing in an infinite loop (+-loops can terminate, but this one won't).

So why does this work for large integers without running out of memory? Retina's $.(…) computation is lazy! Whenever possible, its string argument isn't actually fully evaluated, but its length is computed directly instead. And it knows that a string formed with n*s is n*len(s) characters long. This feature gives us the convenience of a unary approach without the memory requirements. The length computation also uses an arbitrary-precision integer type, so that we can go well beyond 2128.

Martin Ender

Posted 2015-11-14T12:40:24.093

Reputation: 184 808

3

Microsoft PowerPoint (33 Slides, 512 shapes to meet minimum requirements)

Storage representation is in hexadecimal.

Directions

  • Click the blue square to advance the counter (or propagate the carry), or make an AutoHotKey Script to click it for you.
  • You can view the number's digits at any time using the green buttons. (It causes unintended behavior if you click the blue buttons after viewing another digit.) This is just for a better UX. It still counts up as normal as long as you keep clicking the blue button. In other words, no user decision is required.
  • If you reach the end, it displays a congratulatory message.

You can get the PPTX here. Requires PowerPoint to run.

Before you comment that Microsoft PowerPoint is not a programming language, it has been shown that PowerPoint is Turing complete (in the same sense that conventional languages such as C are Turing complete). A brief discussion is given here.

Calculuswhiz

Posted 2015-11-14T12:40:24.093

Reputation: 193

Note: sadly as of the time I write this, this does not work with LibreOffice, as there seems to be a bug where things that appear don't stay that way. – Calculuswhiz – 2020-01-15T03:05:20.893

3

Burlesque, 9 bytes

1R@2SH[-Q

If you don't care what the first character is go with 1R@.

Explanation:

R@ is the RangeInf built-in and creates a Block with numbers [N..Infinity] so 1R@ generates a Block {1 2 3 4 5....}. However, if we display this we'll have a { at the start of our output which we don't want. SH converts a value to a display value (called Pretty) and then back to a String using the display format. 2 is the Format With Spaces so 2SH produces [1 2 3 4 5...]. Now we use [- which is the Tail built-in which removes the first character in that string. Q converts our string to a display value. Burlesque generally prints things as you input them, so when it prints a String there it will be surrounded by quotes. If one doesn't want that we have to convert it to a display value (called Pretty).

blsq ) "hi"
"hi"
blsq ) "hi"Q
hi
blsq ) 5ro
{1 2 3 4 5}
blsq ) 5ro2SH
"[1 2 3 4 5]"
blsq ) 5ro2SH[-
"1 2 3 4 5]"
blsq ) 5ro2SH[-Q
1 2 3 4 5]

mroman

Posted 2015-11-14T12:40:24.093

Reputation: 1 382

BTW: Technically this displays a list as string with the first character removed. So it displays '1 2 3 4 5 ......]' but since it's infinite in size ']' will never be printed. – mroman – 2015-11-14T13:29:29.243

Could you explain this code char by char? I tried the doc, but there's no easy way of searching. – vrwim – 2015-11-14T23:35:13.707

1I've added an explanation. – mroman – 2015-11-16T10:26:14.667

3

C, 93

Count up to 10^97. Add 3 bytes to count up to 10^997 (and so on).

char*p,d[99],*q=d+97;main(){while(p-d)*q>56?(*q--=48):(*q||(*(p=q)=48),++*q,puts(p),q=d+97);}

Less golfed

char*p,d[99],*q=d+97;

main()
{
  while(p!=d)
  {
    if(*q > '8') {
      *q = '0';
      --q;
    }
    else {
      if (!*q) {
        *q = '0';
        p = q; 
      }
      ++*q;
      puts(p);
      q = d + 97;
    }
  }
}

edc65

Posted 2015-11-14T12:40:24.093

Reputation: 31 086

3

dc, 12 bytes

Uses an "anonymous" recursive macro, should be able to run for ever:

z[r1+prdx]dx

daniero

Posted 2015-11-14T12:40:24.093

Reputation: 17 193

1

For once, bc is shorter

– Digital Trauma – 2015-11-14T21:17:54.207

The 11-byte solution is invalid: you cannot store a unary representation of the current number in memory. And besides it starts from 0 rather than from 1. – user46915 – 2015-11-16T11:57:26.797

3

Seriously, 4 bytes

1W■u

Explanation:

1    puts 1 on the stack
W    begins a while loop that executes while the (peeked) value on top of the stack is truthy
  ■    output entire stack without popping
  u    increment value on top of stack
<EOF> implicit end of while loop block

No online interpreter link because it doesn't do so well with infinite loops.

Mego

Posted 2015-11-14T12:40:24.093

Reputation: 32 998

3

Powershell, 43 29 bytes

[Numerics.BigInteger]$i=1;for(){$i;$i=$i+1}

Relies on .Net 4.0 and up for System.Numerics.BigInteger

V2

[BigInt]$i=0;for(){($i=$i+1)}

Thanks to TimmyD for the additional tips for use of parens to a automatically produce output and [bigint] for type assignment.

Booga Roo

Posted 2015-11-14T12:40:24.093

Reputation: 141

1Welcome to PPCG! If you use PowerShell v4+, you can use the [bigint] alias instead of [Numerics.BigInteger]. Additionally, enclosing the variable in parens will automatically produce output, and using the inline ++ instead of assignment shortens as well. Results in [bigint]$i;for(){($i++)} for 24 Bytes. – AdmBorkBork – 2015-11-16T14:06:14.770

@TimmyD Thanks for the tips! I'm using PowerShell 5.0, but couldn't use just [bigint]$i without getting an error. Ran into a few other gotchas with going with just ($i++). I can list them if it would be appropriate. – Booga Roo – 2015-11-16T21:04:14.670

Interesting. v5 (or the behind-the-scenes .NET) must have updated/changed default initializations and/or the ++ operator overload. – AdmBorkBork – 2015-11-16T21:21:24.377

For v5, you can still do for([BigInt]$i=0){($i+=1)} for 25 bytes – Veskah – 2019-07-12T13:08:00.417

3

Scala, 41 39 35 bytes

Stream.iterate(BigInt(0)){_+1}print

Other versions (I left all solutions there because they're significantly different):

def r(n:BigInt){println(n);r(n+1)};r(0)   // 39
var i=BigInt(0);while(1>0)println{i+=1;i} // 41

This is my first time writing Scala code.

Original idea based on SuperJedi224's Java answer.

{i=>i+1} can be shortened to {_+1}.
foreach println was replaced with print because the problem description allows any separator.
Iterator.iterate and Stream.iterate, though completely different, do the same thing.

Other tries

Stream.from(0).print() // overflows at Integer.MAX_VALUE
BigInt(0).to(10)foreach println // 10 should be BigInt.MAX_VALUE (=Infinity), which doesn't exist
def from(start:BigInt):Stream[BigInt]=Stream.cons(start,from(start+1));from(0).print // too long

TWiStErRob

Posted 2015-11-14T12:40:24.093

Reputation: 153

Shouldn't println(i+=1) work just as well? – Bergi – 2015-11-14T22:26:41.007

1

@Bergi no, assignments are not expressions in Scala: their type is Unit (void). I learned that the hard way by trying what you suggest, but REPL outputted (). See for example this on SO. This is the shortest version I could come up with based on this answer. Notice that also there's no increment (++i) operator for BigInts.

– TWiStErRob – 2015-11-14T22:37:32.497

Oh right. Sure, assignment is evil in Scala. More functional would be something like Stream.from(1).forEach(printLn _) I guess, but Stream.from seems to leak memory and not work with BigInts. – Bergi – 2015-11-14T22:59:57.287

@Bergi added all my other tries to the answer. – TWiStErRob – 2015-11-14T23:06:49.177

3

PARI/GP, 23 bytes

i=0;until(print(i+=1),)

Sample Usage

$ gp -qf < countup.gp

primo

Posted 2015-11-14T12:40:24.093

Reputation: 30 891

3

Racket, 40 bytes

(sequence-for-each println(in-naturals))

Racket has arbitrary-precision numbers, so this will continue to count up forever.

Alexis King

Posted 2015-11-14T12:40:24.093

Reputation: 225

3

sed, 116 92 83 bytes

:
/^9*$/s/^/0/
s/.9*$/_&/
h
s/.*_//
y/0123456789/1234567890/
x
s/_.*//
G
s/\n//p
b

Usage: Sed operates on text input and it needs input do anything. To run the script, feed it with just one empty line:

$ echo | sed -f forever.sed

Explanation: To increment a number, the current number is split up into a prefix and a suffix where the suffix is of the form [^9]9*. Each digit in the suffix is then incremented individually, and the two parts are glued back together. If the current number consists of 9 digits only, a 0 digit is appended, which will immediately incremented to a 1.

matz

Posted 2015-11-14T12:40:24.093

Reputation: 141

3

C, 95 bytes

int a,c[50]={-38};main(){for(a=49;++c[a]>9;c[a--]=0);for(a=0;a<50;++a)putchar(c[a]+48);main();}

Prints:

00000000000000000000000000000000000000000000000001
00000000000000000000000000000000000000000000000002
...

Lynn

Posted 2015-11-14T12:40:24.093

Reputation: 55 648

This recurses, not sure if the stack will hold 2^128 call frames.. – Kenney – 2015-11-15T18:30:35.430

3Tail-call optimization will take care of it, so it's no problem. Moreover, the C standard doesn't limit the stack size. – Lynn – 2015-11-15T19:36:28.220

3

Perl 6, 13 bytes

.say for 1..*

Brad Gilbert b2gills

Posted 2015-11-14T12:40:24.093

Reputation: 12 713

3

8086 machine code + DOS, 34 bytes

Hexdump:

30 0D 0A 24 FE C6 BB 00 01 B4 09 CD 21 FE 07 80
3F 3A 75 F2 C6 07 30 4B 3B DA 73 F1 C6 07 30 4A
EB EB

In assembly language:

    .MODEL TINY

    .CODE
    org 100h

MAIN PROC

    db '0',13,10,'$' ; output buffer
    inc dh ; assign dx=0x100 - address of the output buffer

increase_num:
    mov bx, 100h
    mov ah, 9
    int 21h ; print the number

increase_digit:
    inc byte ptr [bx]
    cmp byte ptr [bx], '0'+10
    jne increase_num
    mov byte ptr [bx], '0'
    dec bx
    cmp bx, dx
    jae increase_digit
    mov byte ptr [bx], '0'
    dec dx
    jmp increase_digit

MAIN ENDP
END MAIN

Some explanations:

Output buffer is at offset 0x100; it contains 4 bytes at first: '0', a newline sequence 0d 0a, and '$', which is an end-of-output-buffer byte that DOS uses. These 4 bytes are executed as nonsensical code:

xor [di],cl
or ah,[si]

This destroys the program exit instruction at offset 0, but this is OK because the program will not exit!

The instruction inc dh generates the value 0x100 in dx, which is the address of the output buffer. The output buffer grows down, decreasing the value of dx with each power of 10.

The number is stored as an ASCII string. The increment code starts from the last digit, increases it and checks whether it went out of range 0...9. If yes, it sets the digit to 0 and goes to the next digit (dec bx). If all digits are set to 0, it adds (dec dx) another 0 digit, and immediately increases it to 1.

anatolyg

Posted 2015-11-14T12:40:24.093

Reputation: 10 719

I realize this is an old answer but I'm curious: How can you assume dx and di are zero-initialized? As far as I know their values are undefined on entry. – user5434231 – 2017-04-24T06:17:32.640

3

O, 7 bytes

1{.o)}w

Explanation:

1       Pushes 1 to the stack
 {   }w While the top of the stack is not 0
  .o)   Output the top of the stack and increment it

Does not work on online IDE, but does in REPL and file.

phase

Posted 2015-11-14T12:40:24.093

Reputation: 2 540

3

Mathematica, 22 bytes

For[i=1,1>0,Print@i++]

LegionMammal978

Posted 2015-11-14T12:40:24.093

Reputation: 15 731

3

Brainfuck, 44 bytes

->-<[>>[->>]<[+>>-<<]>+>+[->>+]-<+[-.<<+]-.]

I'm surprised there are no brainfuck submissions, so here's my attempt (and my first brainfuck program). I interpreted the constraint on number formatting as 'whatever is convenient for your language', so the output here is as a binary string of 00 and 01, with FF as separators. The beginning of the output:

0000000: 01 ff 01 00 ff 01 01 ff 01 00 00 ff 01 00 01 ff  ................
0000010: 01 01 00 ff 01 01 01 ff 01 00 00 00 ff 01 00 00  ................

The standard 30000 byte BF implementation can go as high as 2^15000 before reaching undefined behavior. Here is another version which produces a more readable output consisting of "0" and "1" with newlines as separators (currently 105 chars, although this can probably be golfed more):

++++++++++>>->-<[>>[->>]<[+>>-<<]>+>+[->>+]-<+[-[-<+<<+>>>]++++++[-<++++++++>]<.[-]<<[->>>+<<<]>+]-<<.>>]

Output:

1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111

Mario Carneiro

Posted 2015-11-14T12:40:24.093

Reputation: 258

3

WhoScript, 28 27 bytes

1#1;v;e;pw #;#a;pw;#1;+;i;d

Ungolfed/Explanation:

# 1                        @ push 1 to the stack
time_vortex                @ begin an infinite loop
  duplicate                @ duplicates the top of the stack
  psychic_paper write #    @ prints the top of the stack as a number
  # a                      @ pushes 10 (0xA) to the stack
  psychic_paper write      @ prints the character whose ASCII code matches the top of the stack
  # 1                      @ pushes another 1 to the stack
  +                        @ adds the top two stack values (as a floating point number)
  integer                  @ converts the top number of the stack to an integer
paradox                    @ go back to the 'time_vortex' line

Shaved off a byte by using 0xA instead of 0x20

MCS-Kaijin

Posted 2015-11-14T12:40:24.093

Reputation: 109

3

Turing Machine Simulator, 536 bytes

a * * r a
a , * r A
A * * r A
A , * l b
b * * l b
b , * l c
b s 0 l 0
b p 1 l 1
b d 2 l 2
b f 3 l 3
b g 4 l 4
b h 5 l 5
b i 6 l 6
b j 7 l 7
b k 8 l 8
b l 9 l 9
0 * * l 0
0 _ s r a
1 * * l 1
1 _ p r a
2 * * l 2
2 _ d r a
3 * * l 3
3 _ f r a
4 * * l 4
4 _ g r a
5 * * l 5
5 _ h r a
6 * * l 6
6 _ i r a
7 * * l 7
7 _ j r a
8 * * l 8
8 _ k r a
9 * * l 9
9 _ l r a
c _ p l d
c s p l d
c p d l d
c d f l d
c f g l d
c g h l d
c h i l d
c i j l d
c j k l d
c k l l d
c l s l c
d * * l d
d _ , r A

Test it out here -> link
initial input: ,*p,
initial state: b

Explanation:
state a: move right until a comma is found then move to state A
state A: move right until a comma is found then move to state b
state b: move left until a letter or a comma is found. If a letter is found, change the letter to its corresponding digit and move to the corresponding state. If a comma is found, move to state c.
states 0-9: move left until an empty space is found then write the digit
state c: increment the number and end up on the left then move to state d
state d: place a comma then move to state A

Basically, it finds the previous number, copies it over while converting it to digits, increments it, then starts all over.

On a real turing machine this would go way over 2^128

KoreanwGlasses

Posted 2015-11-14T12:40:24.093

Reputation: 888

You could save some bytes by converting this to use binary, I'm not sure whether or not that would improve speed any though – SuperJedi224 – 2016-02-02T15:49:22.853

Not sure if binary is allowed in the rules, but unary would definitely be shorter – KoreanwGlasses – 2016-02-02T15:51:50.720

My BotEngine answer uses binary, at least. – SuperJedi224 – 2016-02-02T16:00:48.733

3

Pyth, 4 bytes

.V1b

.V begins an infinite loop which defines incremented b, starting with 1. The body of the loop implicitly prints b on the next line.

benstopics

Posted 2015-11-14T12:40:24.093

Reputation: 61

3

Brachylog, 6 bytes

#>=@w\

Try it online!

Explanation

#>         Constrain a number in [1,∞)
  =        Assign a value to the number in that interval
   @w      Write the number followed by a linebreak
     \     False ; try another value assignement in the interval

Fatalize

Posted 2015-11-14T12:40:24.093

Reputation: 32 976

3

Fuzzy Octo Guacamole, 4 bytes

(+X)

Explanation:

(+X)
(  )    # Infinite loop.
 +      # Increment ToS, which is 0 by default.
  X     # Print ToS.
        # Implicit output applies to the end of a loop.

Rɪᴋᴇʀ

Posted 2015-11-14T12:40:24.093

Reputation: 7 410

This is a catalogue, not a challenge, so no problem submitting when the language is newer than the question – vrwim – 2016-04-25T14:19:50.043

3

Minecraft 1.9 / Minecraft 1.10, 101 blytes

Curse you, strict 1.9 JSON!

Solution

0,0,0 Impulse command block: scoreboard objectives add a stat.playOneMinute
0,1,0 Lever (off)
0,1,1 Repeating command block: tellraw @p {"score":{"name":"@p","objective":"a"}}

Flip lever to begin, reset with /scoreboard objectives remove a.

quat

Posted 2015-11-14T12:40:24.093

Reputation: 1 211

3

Sesos, 2 bytes

Hexdump:

0000000: 0c3a                                              .:

Try it online!

Assembly:

set numout ;output one number per line instead of character
nop        ;set entry marker (start of loop)
add 1
put
           ;(implicit jnz) set exit marker (end of loop, jump if not zero)

Leaky Nun

Posted 2015-11-14T12:40:24.093

Reputation: 45 011

2

APL (Dyalog), 9 bytes

{∇1+⎕←⍵}1

Try it online!

Erik the Outgolfer

Posted 2015-11-14T12:40:24.093

Reputation: 38 134

2

Aceto, 5 bytes

IkpnO

Explanation:

Aceto follows a Hilbert Curve on a square program. If the program is not square, spaces are added to the top and right. (spaces do nothing) I

I - pops a value, increments it, and pushes it back on
k - makes the stack 'sticky', meaning that when popping a number, instead of removing the value it copies it
p - prints the top value
n - prints a newline
O - Returns the program back to the beginning

Also, can anyone explain to me why 'k' is needed? Shouldn't 'I' do the job just fine? When I omit 'k', it prints out lines and lines of '1's.

Try it online!

FantaC

Posted 2015-11-14T12:40:24.093

Reputation: 1 425

Because p pops the value off the stack. – L3viathan – 2017-12-12T13:55:02.667

1Glad to see people using it! – L3viathan – 2017-12-12T18:28:19.530

2

Alumin, 6 bytes

hqhanp

Alumin is a new language, made by @Conor O'Brien.

Explanation:

hqhanp
h      # Push 1
 q   p # Begin/end loop
  ha   # Push 1, add top two stack elements together (increments top)
    n  # Prints the top of stack as a number

Rɪᴋᴇʀ

Posted 2015-11-14T12:40:24.093

Reputation: 7 410

2

Wumpus, 5 bytes

)=O
N

Try it online!

Explanation

The program runs )=ON in an infinite loop (see the "cat" answer for why that is).

)   Increment the top of the stack. Initially, this turns an implicit zero
    into an explicit one.
=   Duplicate.
O   Print as a decimal integer.
N   Print a linefeed.

Martin Ender

Posted 2015-11-14T12:40:24.093

Reputation: 184 808

2

Brachylog, 4 bytes

ℕ₁ẉᶠ

Explanation

ℕ₁      --  Get a integer which is at least 1
  ẉᶠ    --      and print all possible values (ordered from 1 to inf)

Try it online!

Kroppeb

Posted 2015-11-14T12:40:24.093

Reputation: 1 558

2

Deoxyribose, 35 29 bytes

ATGCCAGAAAAACATAACGGTTTAAATCC

Explanation:

ATG
CCA     (*) Divide (null/null yields 1)
  GAA     Dupe
  AAA     Pop
  CAT     Push
    AAC     1
  GGT     Move 
  TTA     Plus
AAT     Loop
  CC      *

I feel like this can get shorter.

Edit: Saved 6 bytes by making creative use of division of two empty stacks.

georgewatson

Posted 2015-11-14T12:40:24.093

Reputation: 291

2

Python 2 VM Opcodes, 14 bytes?

LOAD_CONST               0
LOAD_CONST               1
INPLACE_ADD
DUP_TOP
PRINT_ITEM
JUMP_ABSOLUTE            2

I'm not sure how to score this, the compiled code is 12 bytes of vm code but there are also the constants, which would be unscored. Each constant can fit in a single bit but I'll count them as 1 byte each for now.

The compiled .pyc file is 106 bytes long(!) and the raw text is 111 bytes long.

I will probably just write a short script that just takes python opcodes and runs them properly (A bit like Pyth but much more low level).

Overall, it's a very simple program. It loads 0 and 1 onto the stack and adds them. This removes both from the stack and leaves it with the result. It then duplicates the stack and prints the value of the first item, removing it from the stack. It then goes to line 2.

.pyc file (hexdump)

03 F3 0D 0A DB 5B 47 56 63 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 73 0C 00 00 00 64 01 00 64 02 00 37 04 47 71 03 00 28 03 00 00 00 4E 69 00 00 00 00 69 01 00 00 00 28 00 00 00 00 28 00 00 00 00 28 00 00 00 00 28 00 00 00 00 74 09 00 00 00 70 79 6B 65 5F 63 6F 64 65 52 00 00 00 00 01 00 00 00 74 00 00 00 00

Blue

Posted 2015-11-14T12:40:24.093

Reputation: 26 661

2

Befunge, 4 bytes

1+:.

This just requires an interpreter with arbitrary precision integers.

PurkkaKoodari

Posted 2015-11-14T12:40:24.093

Reputation: 16 699

You don't even compile your Befunge code? :( – YoYoYonnY – 2015-11-16T18:14:59.773

2

Rotor, 7 bytes

1{1+}|

There's an unprintable again, hexdump:

0000000: 317b 1b31 2b7d 7c                      1{.1+}|

ew 7 bytes

a spaghetto

Posted 2015-11-14T12:40:24.093

Reputation: 10 647

2

Kotlin, 102 bytes

import java.math.BigInteger.*fun main(a:Array<String>){var i=ZERO;while(1>0){i=i.add(ONE);println(i)}}

Based on SuperJedi224's Java answer.

TWiStErRob

Posted 2015-11-14T12:40:24.093

Reputation: 153

2

Acc!, 64 65 bytes

Also works in Acc!!.

Count q while 1 {
Count x while q-x+1 {
Write 7
}
Write 9
}

This prints the numbers out in unary using Bell characters seperated by tabs. If I have to use a more standard character, that would make the program 66 bytes.

The Acc! interpreter provided in the linked answer translates Acc! to Python, which does support arbritrary-precision integers.

pppery

Posted 2015-11-14T12:40:24.093

Reputation: 3 987

2

c + GMP library, 90

Score includes +4 for passing -lgmp to the compiler. You'll need GMP installed to build and run this.

Here's how we do arbitrary precision in c:

#include<gmp.h>
main(){mpz_t i;for(mpz_init(i);mpz_add_ui(i,i,1),gmp_printf("%Zd\n",i););}

Compile with:

cc forever.c -o forever -lgmp

Digital Trauma

Posted 2015-11-14T12:40:24.093

Reputation: 64 644

I don't understand... what's wrong with double long unsigned long i; for(i=0;1>0;i++){printf("v%\n",i)} ? – cat – 2015-12-29T16:04:41.133

@cat I'm not familiar with the double long unsigned long type - which compiler are you using? GCC doesn't like it. – Digital Trauma – 2015-12-29T16:55:15.673

GCC compiled it for me but I didn't realise it segfaulted, never mind ¯_(ツ)_/¯ – cat – 2015-12-29T17:04:51.173

You can remove first include and replace stdout with 1. – Krzysztof Szewczyk – 2018-02-13T17:37:28.383

@KrzysztofSzewczyk How would that work? stdout the stream associated with the STDOUT fd (commonly numerical 1), but is itself a FILE * pointer. mpz_out_str() needs a FILE * and not an int 1. – Digital Trauma – 2018-02-13T19:15:29.623

@KrzysztofSzewczyk By the way, I navigated to the URL you link to on your profile page. My McAfee detected WASM/Cryptonight. Did you know you are spreading trojans? – Digital Trauma – 2018-02-13T19:19:48.917

@DigitalTrauma Didn't know that i'm spreading trojan actually. Going to check this out, thanks for pointing it yout – Krzysztof Szewczyk – 2018-02-14T14:43:18.470

@KrzysztofSzewczyk If you have suggestions to golf this more, it is customary to put those in a comment. Otherwise please stop making edit requests that break the program or make it longer. Thanks. – Digital Trauma – 2018-02-14T17:15:47.607

2

Ceylon (on JVM), 92 87 78 bytes

(The Big integer type Whole which is used here does only exist on the JVM, not when compiling for JavaScript.)

This is the third improvement (78 bytes):

import ceylon.math.whole{o=one}shared void run(){loop(o)(o.plus).each(print);}

The loop function is a functional version of the while-statement – it creates a stream from a starting value (one) and a function (one.plus), applying the function to the previous value until it returns finished (which our function never does, so it becomes an infinite stream). On each element, print(...) is applied.

An Integer version which goes only until just under 2^63 (on JVM) or 2^31 (on JS), then will wrap around to negatives (JVM) or stall (for JS), for 48 bytes:

shared void run(){loop(1)(1.plus).each(print);}


Second version (87):

import ceylon.math.whole{o=one}shared void run(){{o}.cycled.scan(o)(plus).each(print);}

That builds first an infinite stream of ones, and then creates a scanning stream, which calculates the partial sums (which then are each printed).


Original version (92):

A straight-forward n++-loop, with a big integer type (called Whole in Ceylon, but the type name is not actually used in this program, just the name of the 1):

import ceylon.math.whole{o=one}shared void run(){variable value n=o;while(0<1){print(n++);}}


This one is shorter (83), counting from 1 to 2^65536, but it doesn't actually work:

import ceylon.math.whole{o=one,t=two}shared void run(){(o..t^t^t^t^t).each(print);}

The problem is that the range notation x..y will call span(x,y), which will call x.offset(y) to get the offset between them, and this method is defined to return an Integer – which will overflow here, as the difference is much too large to fit into an Integer (which was the whole point of using Whole here).

Paŭlo Ebermann

Posted 2015-11-14T12:40:24.093

Reputation: 1 010

2

GolfScript, 9 bytes

1{.p).}do

1      # push 1
{      # loop
  .p   # duplicate, output
  ).   # increment, duplicate
}do    # while non-zero

primo

Posted 2015-11-14T12:40:24.093

Reputation: 30 891

2

Win32 x86 Machine Code (PE32 Executable), 933 bytes

This implements a virtual datatype using a lookup table (aka array). The challenge requests support for 2^128 which is 39 decimal digits. By accident, this solution supports 38+N digit numbers, where N is the width of word (i.e. two bytes). After that, the behavior is undefined. You might notice a whole lot of too simple or too redundant code in the assembly below, but this is intended, because the compression algorithm optimizes this.

For example,

mov EAX, 0
mov dword [@@DATA+164], EAX

is two bytes shorter than

mov dword [@@DATA+164], 0

Also: I though of using the C runtime library (MSVCRT) to convert numbers to strings, but this is a DIY approach, so this solution contains it's own method of converting numbers to strings. Without this, the byte count would be 800-ish. Keep in mind that the PE header and decompression take up about 697 bytes :). Also, this is Win32 code (fully debugged, shouldn't produce any errors and spawns a clean console context to run in), it is not "just using Interrupts", so this contains it's own string printing method.

I've used MEW11SE to crunch the executable, because MEW's LZMA-E9 routine beats UPX, mpress, kkrunchy etc. 9.9 out of 10 times by far. I could have used nasm and crinkler, but I hate both of them. The assembly below is fasm.

Here's a binary (compressed) - Here's another binary (uncompressed)

Disclaimer: The compressed binary will probably set your PC on fire if you happen to have an AV installed.

Assembly

; minxomat

; Link as CUI subsystem
format PE CONSOLE
section ".code" code readable executable

; Convert single digit unsigned word to null-terminated char
makestr:
  push EBP
  mov EBP, ESP
  sub ESP, 12
  mov EAX, @@TEXT+0
  mov dword [EBP-4], EAX
  mov EAX, @@TEXT+3
  mov dword [EBP-8], EAX
  mov EAX, 0
  mov dword [EBP-12], EAX
  mov EAX, dword [EBP+8]
  add EAX, dword [EBP-8]
  mov AL, byte [EAX+0]
  mov EBX, dword [EBP-12]
  add EBX, dword [EBP-4]
  mov byte [EBX+0], AL
  mov AL, 0
  push EAX
  mov EAX, dword [EBP-12]
  add EAX, 1
  add EAX, dword [EBP-4]
  pop EBX
  mov byte [EAX+0], BL
  mov EAX, dword [EBP-4]
  mov ESP, EBP
  pop EBP
ret 4

; Ouput null-term'ed string at this pointer to console
printme:
  push EBP
  mov EBP, ESP
  sub ESP, 4
  mov EAX, 0
  mov dword [EBP-4], EAX

  addone:
    mov EAX, dword [EBP-4]
    add EAX, dword [EBP+8]
    mov AL, byte [EAX+0]
    cmp AL, 0
    je fwd
    inc dword [EBP-4]
    jmp addone

  fwd:
    xor EAX, EAX
    push EAX
    lea EAX, [EBP-4]
    push EAX
    mov EAX, dword [EBP-4]
    push EAX
    mov EAX, dword [EBP+8]
    push EAX
    mov EAX, 4294967285
    push EAX
    call [@10024]
    push EAX
    call [@10025]
    mov ESP, EBP
    pop EBP
ret 4

; Entry point.
main:
  ; Print initial zero
  push EBP
  mov EBP, ESP
  mov EAX, @@TEXT+14
  push EAX
  call printme

  @10007:
    mov EAX, 1
    mov dword [@@DATA+160], EAX
    mov dword [@@DATA+164], EAX
    mov EAX, 38
    mov dword [@@DATA+156], EAX

  @10008:
    mov EAX, dword [@@DATA+156]
    cmp EAX, 0
    jle @10016

  @10009:
    mov EAX, dword [@@DATA+156]
    shl EAX, 2
    mov EAX, dword [@@DATA+EAX+0]
    mov EBX, dword [@@DATA+160]
    add EAX, EBX
    mov EBX, dword [@@DATA+156]
    shl EBX, 2
    mov dword [@@DATA+EBX+0], EAX
    mov EAX, dword [@@DATA+156]
    shl EAX, 2
    mov EAX, dword [@@DATA+EAX+0]
    cmp EAX, 9
    jle @10011

  @10010:
    mov EAX, 0
    mov EBX, dword [@@DATA+156]
    shl EBX, 2
    mov dword [@@DATA+EBX+0], EAX
    mov EAX, 1
    mov dword [@@DATA+160], EAX
    jmp @10014

  @10011:
    mov EAX, 0
    mov dword [@@DATA+160], EAX

  @10014:
    dec dword [@@DATA+156]
    jmp @10008

  @10016:
    mov EAX, dword [@@DATA+156]
    cmp EAX, 39
    jge @10022

  @10017:
    mov EAX, dword [@@DATA+156]
    shl EAX, 2
    mov EAX, dword [@@DATA+EAX+0]
    cmp EAX, 0
    jg @10019

  @10018:
    mov EAX, dword [@@DATA+164]
    cmp EAX, 0
    jne @10021

  @10019:
    mov EAX, dword [@@DATA+156]
    shl EAX, 2
    mov EAX, dword [@@DATA+EAX+0]
    push EAX
    call makestr
    push EAX
    call printme
    mov EAX, 0
    mov dword [@@DATA+164], EAX

  @10021:
    inc dword [@@DATA+156]
    jmp @10016

  @10022:
    mov EAX, @@TEXT+17
    push EAX
    call printme
    jmp @10007

section ".data" data readable writeable

@@TEXT db "00", 0
       db "0123456789", 0
       db "0", 10, 0
       db 10, 0

@@DATA rb 168

section ".idata" import data readable writeable

dd 0, 0, 0, RVA @10026, RVA @10024
dd 0, 0, 0, 0, 0

@10024 dd RVA @10027
@10025 dd RVA @10028
       dd 0

@10026: db "KERNEL32.DLL", 0

@10027: dw 0
        db "GetStdHandle", 0
@10028: dw 0
        db "WriteFile", 0

section ".reloc" fixups data readable discardable
entry main

Hexdump

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000  4D 5A 6B 65 72 6E 65 6C 33 32 2E 64 6C 6C 00 00  MZkernel32.dll..
00000010  50 45 00 00 4C 01 02 00 00 00 00 00 00 00 00 00  PE..L...........
00000020  00 00 00 00 E0 00 0F 01 0B 01 00 00 00 02 00 00  ....à...........
00000030  00 00 00 00 00 00 00 00 95 51 00 00 10 00 00 00  ........•Q......
00000040  00 10 00 00 00 00 40 00 00 10 00 00 00 02 00 00  ......@.........
00000050  04 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00  ................
00000060  00 60 00 00 00 02 00 00 00 00 00 00 03 00 00 00  .`..............
00000070  00 10 00 00 00 10 00 00 00 00 01 00 00 00 00 00  ................
00000080  00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00  ................
00000090  91 51 00 00 14 00 00 00 00 00 00 00 00 00 00 00  ‘Q..............
000000A0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000000B0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000000C0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000000D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000000E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
000000F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000100  00 00 00 00 00 00 00 00 4D 45 57 00 46 12 D2 C3  ........MEW.F.ÒÃ
00000110  00 40 00 00 00 10 00 00 00 00 00 00 00 00 00 00  .@..............
00000120  00 00 00 00 00 00 00 00 00 00 00 00 E0 00 00 C0  ............à..À
00000130  02 D2 75 DB 8A 16 EB D4 00 10 00 00 00 50 00 00  .ÒuÛŠ.ëÔ.....P..
00000140  A5 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00  ¥...............
00000150  00 00 00 00 E0 00 00 C0 BE 1C 50 40 00 8B DE AD  ....à..À¾.P@.‹Þ.
00000160  AD 50 AD 97 B2 80 A4 B6 80 FF 13 73 F9 33 C9 FF  .P.—²€¤¶€ÿ.sù3Éÿ
00000170  13 73 16 33 C0 FF 13 73 21 B6 80 41 B0 10 FF 13  .s.3Àÿ.s!¶€A°.ÿ.
00000180  12 C0 73 FA 75 3E AA EB E0 E8 72 4E 00 00 02 F6  .Àsúu>ªëàèrN...ö
00000190  83 D9 01 75 0E FF 53 FC EB 26 AC D1 E8 74 2F 13  ƒÙ.u.ÿSüë&¬Ñèt/.
000001A0  C9 EB 1A 91 48 C1 E0 08 AC FF 53 FC 3D 00 7D 00  Éë.‘HÁà.¬ÿSü=.}.
000001B0  00 73 0A 80 FC 05 73 06 83 F8 7F 77 02 41 41 95  .s.€ü.s.ƒø.w.AA•
000001C0  8B C5 B6 00 56 8B F7 2B F0 F3 A4 5E EB 9B AD 85  ‹Å¶.V‹÷+ðó¤^ë›.…
000001D0  C0 75 90 AD 96 AD 97 56 AC 3C 00 75 FB FF 53 F0  Àu..–.—V¬<.uûÿSð
000001E0  95 56 AD 0F C8 40 59 74 EC 79 07 AC 3C 00 75 FB  •V..È@Ytìy.¬<.uû
000001F0  91 40 50 55 FF 53 F4 AB 75 E7 C3 00 00 00 00 00  ‘@PUÿSô«uçÃ.....
00000200  33 C9 41 FF 13 13 C9 FF 13 72 F8 C3 66 51 00 00  3ÉAÿ..Éÿ.røÃfQ..
00000210  73 51 00 00 00 00 00 00 00 50 40 00 30 01 40 00  sQ.......P@.0.@.
00000220  8D 10 40 00 00 10 40 00 55 03 89 E5 83 EC 0C B8  ..@...@.U.‰åƒì.¸
00000230  81 20 40 C3 D1 45 FC E1 03 53 08 F8 70 20 E1 11  . @ÃÑEüá.S.øp á.
00000240  F4 8B EC 08 03 CE 1C 8A 1E 1E 5D FC 73 3E FC 88  ô‹ì..Î.Š..]üs>üˆ
00000250  38 B0 37 50 26 B1 83 C0 01 BF 2C 3F 5B B7 18 18  8°7P&±ƒÀ.¿,?[·..
00000260  60 89 EC 5D C2 70 04 AB 46 BD 33 36 FC 66 2F 40  `‰ì]Âp.«F½36üf/@
00000270  08 6C 70 3C 18 74 05 FF 18 EB EF 0D 31 C0 50 8D  .lp<.t.ÿ.ëï.1ÀP.
00000280  10 A2 76 04 7C 08 1B B8 F5 FF 02 F7 41 15 28 30  .¢v.|..¸õÿ.÷A.(0
00000290  B2 DA 0F 2C 28 47 E2 B8 0E A1 82 50 E8 AB BD 45  ²Ú.,(Gâ¸.¡‚P諽E
000002A0  B1 01 9F A3 B3 BA 21 B7 B7 0B F5 26 08 0F AF 94  ±.Ÿ£³º!··.õ&..¯”
000002B0  A1 05 1C 83 F8 0A 7E 6A 0A 80 C1 E0 02 8B 80 13  ¡..ƒø.~j.€Áà.‹€.
000002C0  DD 13 94 1D 2D 1A 01 D8 10 20 17 E3 02 89 83 84  Ý.”.-..Ø. .ã.‰ƒ„
000002D0  8D 25 31 70 09 7E DE 9A AA 36 27 85 6F 0D EB 0A  .%1p.~Þšª6'…o.ë.
000002E0  40 18 0C FF 50 0D 25 EB 53 8C 74 0A 27 7D 49 4F  @..ÿP.%ëSŒt.'}IO
000002F0  F3 80 7F 0A A1 52 B7 0A 15 75 24 1D A4 04 C8 9D  ó€..¡R·..u$.¤.È.
00000300  FE 19 0C DD 14 22 53 B7 11 05 0C AD 2A B8 11 23  þ..Ý."S·....*¸.#
00000310  44 C0 E9 55 10 F0 80 00 00 20 40 00 30 E3 C3 98  DÀéU.ð€.. @.0ãØ
00000320  31 32 33 03 34 35 36 37 38 39 38 16 0A 72 C0 00  123.4567898..rÀ.
00000330  D1 4F 40 00 28 38 30 40 07 4B 45 52 4E 30 4C 33  ÑO@.(80@.KERN0L3
00000340  32 2E 75 44 ED C0 80 47 1C 65 74 53 83 64 48 61  2.uDíÀ€G.etSƒdHa
00000350  6E A3 6C D6 1C 1F 57 72 69 FB BA 46 51 0B 80 00  n£lÖ..WriûºFQ.€.
00000360  00 00 00 00 D1 4F 40 00 4C 6F 61 64 4C 69 62 72  ....ÑO@.LoadLibr
00000370  61 72 79 41 00 47 65 74 50 72 6F 63 41 64 64 72  aryA.GetProcAddr
00000380  65 73 73 00 00 00 00 00 00 00 00 00 00 00 00 00  ess.............
00000390  00 0C 50 00 00 E9 BE AF FF FF 00 00 00 02 00 00  ..P..龯ÿÿ......
000003A0  00 0C 50 00 00                                   ..P..

mınxomaτ

Posted 2015-11-14T12:40:24.093

Reputation: 7 398

Can't you save header by using a .com file? – TWiStErRob – 2015-11-15T09:26:05.507

@TWiStErRob That would be no fun. (Plus no one would be able to run it). – mınxomaτ – 2015-11-15T10:07:56.450

1I thought Dosbox or a VM with WinXPx86 downwards would do it. – TWiStErRob – 2015-11-15T10:12:53.360

@mınxomaτ - you should take a look at clinkster unless you're already familiar with it. It's a 4k synth - the output of a 2m38s Renoise track built into an exe alongside the synth, using crinkler is 2,838 bytes. It's 3 times the size of your program, grabs 100MB of mem and thrashes 1 core of an i7 3537u for 23 seconds before the music starts. It's pretty impressive! Right up there with "Farbrausch - fr-041: debris". (Also small point - you've mistakenly said that the word size of a 32 bit program is 16 bits) Here's Clinkster's page at Pouet: http://www.pouet.net/prod.php?which=61592

– enhzflep – 2015-11-15T12:26:35.673

2

C + gcc extensions, 77 bytes

char c[]={[0 ...49]=48};main(a){for(;;puts(c))for(a=49;++c[a]>57;c[a--]=48);}

xsot

Posted 2015-11-14T12:40:24.093

Reputation: 5 069

2

Prolog (SWI), 35 bytes

p:-between(1,inf,N),writeln(N),1=2.

Edit: Saved 6 bytes thanks to @Fatalize

Emigna

Posted 2015-11-14T12:40:24.093

Reputation: 50 798

A 35 bytes solution is possible, using the SWI-Prolog predicate between/3 : p:-between(1,inf,N),writeln(N),1=2.. It will count up to infinity (inf) because of the 1=2 which will induce backtracking after each integer printed. – Fatalize – 2016-02-02T15:17:30.250

@Fatalize: oh right, you can use inf like that. – Emigna – 2016-02-02T19:58:13.583

2

Common Lisp, 30 bytes

(do((i 0))(())(print(incf i)))

or

(do((x 0(1+ x)))(())(print x))

This should get to 2128 without a problem, since Common Lisp has bignums. E.g.:

CL-USER> (print (expt 2 128))
; 340282366920938463463374607431768211456

Joshua Taylor

Posted 2015-11-14T12:40:24.093

Reputation: 660

2

JacobFck, 10 Bytes

This is so short!

^1:m^1+>_m

See expanded and commented here.

Jacob Misirian

Posted 2015-11-14T12:40:24.093

Reputation: 737

Does this work up to 2^128? – Dennis – 2015-12-29T20:43:39.277

I feel that 10 bytes are pretty long. – None – 2019-12-14T07:09:15.373

2

JavaScript, 80 bytes

r=t=>{t=a.pop()||0;if(++t>9){r();t=0}a.push(t)};for(a=[1];;r())alert(a.join(''))

To test at 2^128 in console, for 1000 cycles;

r=t=>{t=a.pop()||0;if(++t>9){r();t=0}a.push(t)};for(x=1,a=[3,4,0,2,8,2,3,6,6,9,2,0,9,3,8,4,6,3,4,6,3,3,7,4,6,0,7,4,3,1,7,6,8,2,1,1,4,5,6];x<=1000;r(),x++)console.log(a.join(''))

And to test all 9s for 2 cycles;

r=t=>{t=a.pop()||0;if(++t>9){r();t=0}a.push(t)};for(x=1,a=[9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9];x<=2;r(),x++)console.log(a.join(''))

My original idea was to actually use objects, but the array idea turned out to be super small. Mine should be the smallest JavaScript one at the moment

Object Oriented: 107 bytes

function d(p){var x=0,s="";this.o=q=>{return++x>9&&(x=0,p=p||new d,s=p.o()),s+x}}for(c=new d;;)alert(c.o())

Adam Dally

Posted 2015-11-14T12:40:24.093

Reputation: 331

How does this work? Strings? – clamchowder314 – 2016-04-01T12:18:59.663

Also, be sure to avoid the maximum call stack size, which is 19299. – clamchowder314 – 2016-04-01T12:20:07.197

Each digit is an item in an array. And a function is defined so that the last item is popped off and 1 is added to that item. If the item is 10 then it recursively calls the function popping off the next item and so on. If it is not 10 then it just pushes the item back onto the array. – Adam Dally – 2016-04-02T00:40:58.967

Therefore, the stack size is equal to the number of digits. And 19299 digits leaves the largest number capable of running in this script to be 9.99999.... x 10^1929.9, much much larger than the number of atoms in the observable universe. The fastest computer in the world can do 33.86 x 10^15th operations per second, which would take 3.38 x 10^16 seconds if each operation were an entire iteration, or about a billion years, before the stack reached its max call size. :) – Adam Dally – 2016-04-02T01:03:23.133

2

Aubergine, 61 bytes

=A1+i1
=bi-b1-b1:Ba+b1=oB+A1=aA-a1-ii               =oB-a1-ii

Try It Online! but be sure to hit Kill quickly so as to not crash your browser!

Prints in unary, one number per line. The Python interpreter, at least, will ensure it runs forever. (Make sure it is EXACTLY 61 bytes if you run it: adjust the number of spaces in the middle if it is not.)

How it works:

=A1                      SET MEM[0]=1 (this will be the counter).
   +i1                   JUMP 1 byte forward. (Skips the newline.)
   =bi-b1-b1             SET b=5 (points to the '1'=49 on the prev line)
   :Ba                   JUMP to 49 if a>0 (Will land on the other side of the spaces)
   +b1                   SET b=6 (now points to the newline)
   =oB                   OUTPUT what b points to (the newline)
   +A1                   INC MEM[0]
   =aA                   COPY MEM[0] INTO a (but we haven't printed the prev num yet!)
   -a1                   DEC a (Now a=the prev num)
   -ii                   JUMP to the beginning
                        (The sixth instruction jumps here when a>0:)
      =oB                OUTPUT contents of b ('1')
      -a1                DEC a
      -ii                JUMP to the beginning

quintopia

Posted 2015-11-14T12:40:24.093

Reputation: 3 899

2

awk , 65 bytes

BEGIN{for(;;){for(;++$++i>9;)$i=0;for(i=NF+1;i;)printf--i?$i:RS}}

Counts up "forever" using the fields as an array. I made sure this works with the standard Ubuntu awk (mawk).

Cabbie407

Posted 2015-11-14T12:40:24.093

Reputation: 1 158

2

GNU sed, 36

(score includes +1 for requiring the -r flag)

:=
p
s/$/1/
:
s/(^|_)1{10}/1_/
t
b=

This counts in unary-coded decimal, and must be primed with the starting number in UCD (e.g. 1) on stdin:

$ ./63834.sed <<<1 | head -n 30
1
11
111
1111
11111
111111
1111111
11111111
111111111
1_
1_1
1_11
1_111
1_1111
1_11111
1_111111
1_1111111
1_11111111
1_111111111
11_
11_1
11_11
11_111
11_1111
11_11111
11_111111
11_1111111
11_11111111
11_111111111
111_

Here's a version that takes input and output in decimal (now using x as the digit and 0 as separator):

#!/bin/sed -rf

s/[1-9]/0&/g
s/[5-9]/4&/g
y/8/4/
s/9/4&/g
s/4/22/g
s/[37]/2x/g
s/[26]/xx/g
s/[1-9]/x/g


:=
h
s/0x/-x/g
s/xx/2/g
y/x/1/
s/22/4/g
s/44/8/g
s/81/9/g
s/42/6/g
s/21/3/g
s/61/7/g
s/41/5/g
s/-//g
p

g
s/$/x/
:
s/(^|0)x{10}/x0/
t
b=

This is the same code, but with UCD/decimal conversion going on. This makes it easier to make it start at 2^128:

$ bc <<<'2 ^ 128' | ./63834.sed | head -n 10
340282366920938463463374607431768211456
340282366920938463463374607431768211457
340282366920938463463374607431768211458
340282366920938463463374607431768211459
340282366920938463463374607431768211460
340282366920938463463374607431768211461
340282366920938463463374607431768211462
340282366920938463463374607431768211463
340282366920938463463374607431768211464
340282366920938463463374607431768211465

Toby Speight

Posted 2015-11-14T12:40:24.093

Reputation: 5 058

2

GNU coreutils, 16 bytes

seq `bc<<<2^225`

GNU seq happily handles values over 2^128. 2^225 is the largest value bc will print without wrapping (it assumes 80-character width), so that's what I've used here.

Here's the proof that we can handle values higher than 2^227 (dc wraps one char later than bc):

$ seq `dc -e2d227^p` `dc -e2d227^10+p`
215679573337205118357336120696157045389097155380324579848828881993728
215679573337205118357336120696157045389097155380324579848828881993729
215679573337205118357336120696157045389097155380324579848828881993730
215679573337205118357336120696157045389097155380324579848828881993731
215679573337205118357336120696157045389097155380324579848828881993732
215679573337205118357336120696157045389097155380324579848828881993733
215679573337205118357336120696157045389097155380324579848828881993734
215679573337205118357336120696157045389097155380324579848828881993735
215679573337205118357336120696157045389097155380324579848828881993736
215679573337205118357336120696157045389097155380324579848828881993737
215679573337205118357336120696157045389097155380324579848828881993738

Toby Speight

Posted 2015-11-14T12:40:24.093

Reputation: 5 058

I discovered yesterday that GNU 'seq' will accept inf as the upper limit, but it then falls back to scientific notation (printf '%g' format), so it didn't help in the way I wanted... – Toby Speight – 2016-02-19T09:25:07.240

2

Bash, 31, 47 46 bytes

for((i=0;;i=`echo "$i+1"|bc`));do echo $i;done

I'm a bash novice but I've been wanting to use bash in code golf for a while. There must be a better way than this though, I'm sure it can be beaten!

I believe this fixes the issues.

> a=$((2**128))    # Too big
> echo $a
0

> a=$(echo "2^128"|bc)    # Works!
> echo $a
340282366920938463463374607431768211456

So all expressions are piped through bc to make sure it can handle them. It returns a string representation to the variable, which can then be printed. Open to golfing, maybe I can use bc better or maybe I can do code substitution better.

Ogaday

Posted 2015-11-14T12:40:24.093

Reputation: 471

Does this satisfy the requirement of being able to reach 2^128 without running out of memory? – SuperJedi224 – 2016-02-02T15:05:56.420

Honestly, I don't know! Aside from letting it run, how would I find out? – Ogaday – 2016-02-02T15:06:27.357

What size are bash's integers? – SuperJedi224 – 2016-02-02T15:07:57.743

1I'm getting the impression it's system defined, and probably won't be able to hit 2**128 – Ogaday – 2016-02-02T15:21:03.620

Bash only has 64-bit signed integers so you'll always be limited to 2^63-1 unless you outsource to bc, dc or similar. Or just use bc standalone...

– Digital Trauma – 2018-02-13T19:23:51.593

2

F#, 50 49 36 bytes

let rec(!)d=printfn"%O"d;!(d+1I)
!1I

BigIntegers made this pretty easy, although I didn't know I could access them this easily in F#. =)

Update: It's even easier! You don't have to use bigint 1 when you can use 1I! =D

Without using BigInteger, I was able to get it down to 153 bytes. Note that this uses a base 256 representation, with a space between the digits and a newline between the numbers:

let rec i=function|255::[]->0::[1]|255::r->0::(i r)|n::r->(n+1)::r
let rec f d=printfn"%s"(List.rev d|>Seq.fold(fun s c->s+" "+(string c))"");f(i d)
f[0]

The function revolves around treating a list of byte-sized integers as a big number. The recursive function i increments that number (carrying changes up the digits by calling itself if needed), while the recursive function f prints the list as a number, increments the list, then calls itself.

Overall, a pretty fun problem. Thanks! =)

Saved a byte thanks to a trick I saw @Lynn do: name your functions with a character to call them more concisely. Thanks! =)

Roujo

Posted 2015-11-14T12:40:24.093

Reputation: 353

2

Pylons, 8

1w1+p,1}

How it works:

1       # Pushes 1 on the stack.
w       # Starts a while loop.
 1+     # Pushes one and adds the top two elements of the stack.
   p    # Prints the stack. 
    ,   # Command,Condition seperator.
     1  # Condition, in this case, loop while 1.
      } # End the while loop.

Morgan Thrapp

Posted 2015-11-14T12:40:24.093

Reputation: 3 574

2

Retina, 73 bytes

No unary! Taken mostly from this SO answer. As noted by Martin, this code doesn't work in the newest version of Retina. Change (;`(\d+) to {;`(\d+) for it to work.

:`^$
1
(;`(\d+)
0$1~01234567890
:`^0(?!9*~)|(\d)(?=9*~\d*?\1(\d))|~\d*
$2

Try it online

It is much shorter if it was able use unary.

mbomb007

Posted 2015-11-14T12:40:24.093

Reputation: 21 944

It doesn't work. – Leaky Nun – 2016-04-23T23:27:59.820

@KennyLau It used to at the time. I made some changes since then which broke backward-compatibility. You'd just need to turn the ( into a { to fix it. – Martin Ender – 2016-04-25T13:55:56.587

Perhaps you should include a version number in the answer header, then. – msh210 – 2016-04-25T18:34:51.147

2@msh210 I'm not going to edit every single Retina answer I've ever posted every time Martin updates Retina. Look at the date I posted the answer, and use the version of Retina that corresponds to it. – mbomb007 – 2016-04-25T18:37:15.653

2

Hoon, 25 bytes

$:|=(a/@ ~&(a $(a +(a))))

Just repeatedly prints the sample of the gate, and recurses with a = a+1. Hoon's native number is a bignum backed by gmp, so it should be able to count up to 2^128 just fine. Simply paste that code into the Hoon repl (:dojo) in Urbit to run it.

It does abuse the feature of Hoon that gates are instantiated with a default sample, though. Pulling the $ arm for the gate runs it immediately, with the sample set to that default instead of having to call it with (f 0). It's actually smaller to do it this way instead of =+(a=0 |-(~&(a $(a +(a)))))

RenderSettings

Posted 2015-11-14T12:40:24.093

Reputation: 620

Is all of the whitespace necessary? – Addison Crump – 2016-02-29T01:16:53.543

Unfortunately, yes. It's the seperation of twigs: ~& takes two expressions, one to print and one to evaluate to. a(b c) is sugar for recursing to a with b set to c, so they have to be seperate expressions as well. The a/@ part is the type signature of the gate, and is even in a different syntax (tile syntax instead of twig). – RenderSettings – 2016-02-29T01:20:37.213

2

Shakespeare Programming Language, 113 bytes

Nym is a character from Henry V. In the same play, a character named "Boy" has 16 speeches, which counts IMO.

Although there even is a parser for SPL, I didn't check this -- but it should be valid. Also, since that parser simply translates the code to C, counting to 2^128 won't work. However, SPL itself doesn't impose a limit on the size of "variables" -- and I just felt like adding this to the list anyway :-)

.
Nym,.
Boy,.
Act I:
Scene I:
[Enter Nym,Boy]
Nym:Be thyself and a cat.Open your heart.We must return to Scene I.

Christallkeks

Posted 2015-11-14T12:40:24.093

Reputation: 377

1I don't know of any parser that uses the character "boy" or "nym" The shortest you could get would probably be Ajax, Puck, Page, or Ford. – clamchowder314 – 2016-04-01T12:14:50.410

That is correct, however I think that is an implementation issue, as per the language's definition ("a real Shakespeare character name") Nym and Boy would be perfectly legal. – Christallkeks – 2016-04-02T20:19:30.427

That is far from the only thing making this invalid SPL. You need at least a 1-character play title, you didn’t terminate your act and scene names, you didn’t separate “Enter” with ‘and’, and you cannot do assignment with ‘be’. I’d advise against posting unchecked code in the future. – Hello Goodbye – 2019-11-21T17:27:32.397

2

Jelly, 3 bytes

Ṅ‘ß

Try it online! Be careful though, since this is a long output after all!

Ṅ            Print with newline
‘            Increment
ß            Call current link (function) again

Since there are no input arguments, the initial argument is taken to be 0.


Previous version:

Ṅ‘$ÐL

Try it online!

Ṅ            Print with newline
‘            Increment
$            Combine previous two
ÐL           Loop until

Sp3000

Posted 2015-11-14T12:40:24.093

Reputation: 58 729

This should be ‘Ṅß instead, since the implicit argument is 0, so incrementation goes first. As it is right now, it's not valid at all. Your previous version also needs to be fixed. – Erik the Outgolfer – 2016-10-06T15:46:55.857

2

Perl, 20 19 bytes

perl -E 's//0/;say while++$_'

Magic string increment makes this work without bigint

Ton Hospel

Posted 2015-11-14T12:40:24.093

Reputation: 14 114

2

Retina, 20 bytes

<empty line>
39$*0
+:T`9d`d`.9*$

Can count to 10**39-1.

Try it online!

Without leading zeroes (can count beyond 10**39): 23 bytes

+:(T`9d`d`.9*$
^0*$
1$&

Try it online!

13 bytes if pre-initialized with input as 39 "0"s:

+:T`9d`d`.9*$

Try it online!

Leaky Nun

Posted 2015-11-14T12:40:24.093

Reputation: 45 011

2

UGL, 14 bytes

cul$oucuuu$*O:

Try it online!

How it works:

cul$oucuuu$*O:
cu              #i=1
  l          :  #while i:
   $o           #    print(i)
     u          #    i++
      cuuu$*O   #    print(chr(9))

Leaky Nun

Posted 2015-11-14T12:40:24.093

Reputation: 45 011

2

Scratch, 10 bytes

Script
(scoring used)
Resets, then adds n to the list and increases n by 1 in an indefinite loop.

weatherman115

Posted 2015-11-14T12:40:24.093

Reputation: 605

Shorter: don't use "n" and add ((length of [list v]) + (1)) like this: http://puu.sh/pB9eQ.png

– quat – 2016-06-21T22:12:38.557

2

Oracle SQL, 42 Bytes

select level from t connect by level=level

Giacomo Garabello

Posted 2015-11-14T12:40:24.093

Reputation: 1 419

1

Billiards, 15 bytes/11 characters, non-competing

Non-competing, because the language was made after the challenge.

Inspired by PhiNotPi's Challenge

1/\
 ↥↑
\^/

Explanation: 1 summons a ball with value 1. It falls onto the \, which deflects it into the ^.

Then, it levitates from the ^, goes to the which prints its value. Then it deflects off the /, and then hits the \ and begins falling again. It hits the which increments its value, and then hits the / and deflects back into the ^.

Bonus: Replace 1 with a to output the starting point.

Bonus: Add b to the end of the first row and < to the end of the last row to specify the ending point.

HyperNeutrino

Posted 2015-11-14T12:40:24.093

Reputation: 26 575

1

SmileBASIC, 87 bytes

S$="0"*#Y@L
I S$,127?S$GOTO@L
DEF I S,P
IF"0"<S[P]THEN S[P]="0"I S,P-1 ELSE S[P]="1
END

Uses a recursive function to increment a binary string.

12Me21

Posted 2015-11-14T12:40:24.093

Reputation: 6 110

1

Swift - 32 bytes

for i in 0...Int64.max{print(i)}

Swift - 33 bytes

var i=0;while true{print(i);i+=1}

Cannot provide a testing link, because on the online environments this produces a buffer overflow. However, you can test it in Xcode / Swift Playgrounds or if you have an apple computer, you can run it in the Terminal, after typing the 'swift' command and pasting the code in.

Mr. Xcoder

Posted 2015-11-14T12:40:24.093

Reputation: 39 774

Since I haven't been able to reach you anywhere else: Please don't approve edits that golf code, such as this one. Site policy is to not do that. Please reject via "conflicts with author's intent" or "causes harm".

– Rɪᴋᴇʀ – 2017-04-24T21:33:30.597

1

Whitespace, 40 bytes

   

  
   	
	    
 	
 	   	 	 
	
  
 


Try it online!

Outputs numbers separated by newlines. Whitespace numbers are integers of arbitrary length however certain interpreters may impose their own limits due to the implementation language. As a counterexample, whitespace.pl theoretically should be able to output forever as Perl supports arbitrary length integers.

Explanation

(s - space, t - tab, n - newline)

sssn     # push 0 - stack: [0]
nssn     # label ''
ssstn    # push 1 - stack: [<n-1>, 1]
tsss     # pop and add the top two items, push result - stack: [<n>]
sns      # duplicate the top item - stack: [<n>, <n>]
tnst     # pop, print as num - stack: [<n>]
ssststsn # push 10 - stack: [<n>, 10]
tnss     # pop, print as char (LF) - stack: [<n>]
nsnn     # jump to label ''

Ephphatha

Posted 2015-11-14T12:40:24.093

Reputation: 581

1

Braingolf, 10 bytes

1[!_2+# @]

Try it online!

totallyhuman

Posted 2015-11-14T12:40:24.093

Reputation: 15 378

1

Triangular, 15 10 9 bytes

-5 thanks to caird

\#iA.,/%<

Try it online!

Formatted:

   \
  # i
 A . ,
/ % < ÿ

Redirects/bounces only:

   \
  . .
 . . ,
/ . <

So the code i%A# is repeated infinitely.

  • i - increment top of stack
  • % - print top of stack as integer
  • A - push 10
  • # - print top of stack as ASCII and pop

MD XF

Posted 2015-11-14T12:40:24.093

Reputation: 11 605

10 bytes – caird coinheringaahing – 2017-11-14T17:22:46.267

@cairdcoinheringaahing Thanks! Managed to get it down to 9. – MD XF – 2017-11-14T17:41:16.850

1

T-SQL, 47 Bytes

DECLARE @ NUMERIC(38)=1F:PRINT @ SET @+=1GOTO F

Unfortunately, it only goes up to 2^126...

WORNG ALL

Posted 2015-11-14T12:40:24.093

Reputation: 61

1

TI-BASIC (Z80), 152 bytes

Hex dump:

2a31323334353637383904aa003f2a3004aa013fd1313fdeaa013fbb2baa0104413f3104463fd1416c3040463fbb0caa012b412b31116a2a3904463f41713104413fd43fce463fcf3f2a313fd03fbb0caa002b3170bb2abb0caa012b4170312b3111112b313fce413fbb0caa012b312b411170723fd43fd3492b312bbb2baa0111714171b8463f72702a303fd43f7204aa013fd4

Token rendering:

"123456789→Str1
"0→Str2
While 1
Disp Str2
length(Str2→A
1→F
While A>0 and F
sub(Str2,A,1)="9→F
A-1→A
End
If F
Then
"1
Else
sub(Str1,1+expr(sub(Str2,A+1,1)),1
If A
sub(Str2,1,A)+Ans
End
For(I,1,length(Str2)-A-not(F
Ans+"0
End
Ans→Str2
End

Implements incrementing on string-based decimal arbitrary-precision nonnegative integers. I haven't put much effort into golfing this, since just working with strings in this language is already hard enough.

The program should work on the whole TI-83 through -84 series (tested on the TI-84 Plus SE).

Encoding

TI-BASIC code, like all text on the TI-8X, uses its own token-based encoding (see these token tables provided by a third party).

Output

Output is in decimal through Disp, which essentially prints a string on its own line. On the TI-83 through TI-84 Plus SE calculators, once the numbers get large enough that they no longer fit on the display they'll appear truncated with ellipses in the last column. This is by far the TI-BASIC output method closest to standard out.

Jakob

Posted 2015-11-14T12:40:24.093

Reputation: 2 428

1

AutoHotkey, 27 bytes

Based on Michelfrancis' answer: https://codegolf.stackexchange.com/a/78480/72779.

(Should I post this as a reply instead? Pretty new to this, but I don't have enough reputation to reply to other answers anyway.)

c=0         ; Colon-equal operator not required.       Saves one byte.
Loop{       ; Removed space between Loop and {.        Saves one byte.
c++         ; Shorter incremeting method, removed tab. Saves four bytes.
tooltip %c% ; Removed tab.                             Saves one byte.
}

user72779

Posted 2015-11-14T12:40:24.093

Reputation:

Posting a separate answer is completely fine. Once you have enough rep to comment, you may prefer to leave the improvement as a suggestion instead, but it's ultimately up to you. – Martin Ender – 2018-01-23T09:08:37.453

1

Rail, 30 bytes

$'main'
/-uuo\
|     |
\o] [-/

Try it online!

Explanation:

$'main'    Is the beginning of every Rail program, and the train starts moving south-east from $.
/-uuo\     The train then hits '-' which makes it move east. 
|     |    It then hits 'u' which pushes the number of elements on the stack, before printing with 'o'.
\o] [-/    This simply pushes a space to the stack, and prints it. The '-' has to be there, so it starts moving west.

The movment of the train, is essentially just in a circle.

Håvard Nygård

Posted 2015-11-14T12:40:24.093

Reputation: 341

1

Pyt, 6 bytes

0`⁺ĐƤł

Try it online!

0   pushes zero
`   starts a while non-zero loop (but isn't checked until close loop)
⁺   increments x
Đ   Duplicates x
Ƥ   Prints with a separating newline
ł   go back to ` and loop till top is zero

FantaC

Posted 2015-11-14T12:40:24.093

Reputation: 1 425

1

Stax, 4 bytes

0W^Q

Run and debug it online

Added for completeness.

Explanation

0        Pushes 0
 W       Loop forever
  ^      Increment
   Q     Peek and print with newline

Weijun Zhou

Posted 2015-11-14T12:40:24.093

Reputation: 3 396

1

Flobnar, 15 bytes

 \@
+_
<.9,!
>:

Try it online!

Uses the -d flag in order to output in decimal. The separator between numbers is the tab character

Jo King

Posted 2015-11-14T12:40:24.093

Reputation: 38 234

1

Pip, 6 bytes

W1P++i

Try it online!

Straightforward; in pseudocode, this is

while(1)
 print(++i)

where i is preinitialized to 0.

DLosc

Posted 2015-11-14T12:40:24.093

Reputation: 21 213

1

Alchemist, 19 bytes

0a->Out__+Out_" "+_

Try it online!

Prints numbers separated by spaces.

Explanation:

0a->                 # While there are no a atoms (i.e. always)
    Out__            # Output the number of _ atoms
         +Out_" "    # Print a space
                 +_  # Add an _ atom to the environment

Jo King

Posted 2015-11-14T12:40:24.093

Reputation: 38 234

1

Runic Enchantments, 446 bytes

\DB͍R"000000000000000000000000000000000000001"$
.{ww;'''''''''''''''''''''''''''''''''''''''
.10{BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
a+'0000000000000000000000000000000000000000
kk0~111111111111111111111111111111111111111
$:{~+++++++++++++++++++++++++++++++++++++++
1'~}567890123456789012345678901234567890123
J://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
.=? 000001111111112222222222333333333344444
/\/v\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Try it online!

This one took me a while. Runic is not set up to handle arbitrarily large values. The C# interpreter is limited by the fixed bit width of the value types involved, none of which are 128 bits wide and no language commands result in a BigInt being pushed to the stack.

So, instead, I used a string. But decomposing a string into that many characters (and then concatenating them back together again) is a nightmare (especially with that many digits as the instruction pointer starts to fizzle when its stack is too big--there are limited workarounds to that, but this setup works for actually arbitrarily large values, provided that the program is made bigger to accommodate; question specification only required up to 2128 which requires 39 digits; each additional power of 10 adds 10 bytes), so instead the storage is done inside the source code and updated with reflection. I also saw no clarification on whether or not leading 0s were allowed or not, but having them made things much easier.

Control flow

Image depicts fewer decimal digits for brevity as well as the Red/Yellow/Purple sections offset by 1, due to an old version of the code.

  • Cyan: Entry point and output. Reads a string value, pushes it to output, prints a newline, increases mana by 1 (reflection costs 1 mana; image is missing this command), and then enters the blue section via torodial edge wrapping.
  • Blue: Read character from the string, edge wrap to Green.
  • Green: push x position of the read character (in a consistent format, largely for convenience of the programmer), push 1,1 and Branch to position 1,1 (Red).
  • Red: rotate character to top of stack, add 1, convert to character, duplicate, compare with : ('9'+1 equals :). If true, go to Yellow. Else go to Purple.
  • Yellow: Toss out the Branch return coordinates, push a 0 (y coordinate for the write command), write the value, proceed to Cyan.
  • Purple: Toss out the top of the stack (the :), push a 0 (y coordinate for the write command), push a '0' character, write the 0, return to Branch entry (Salmon) using the modified form, which does not push return coordinates (so two giant rows of ~ aren't needed).
  • Salmon (was supposed to be Orange): Repeat steps Blue and Green on the next power of 10.

If it ever fills the entire string with 9s, the next loop would replace it all with 0s and hit the terminator ;. As the online interpreter has a built-in arbitrary maximum execution limit (not including TIO's external limits), this will never actually occur, but that's an implementation detail and not imposed by the language specification.

Draco18s no longer trusts SE

Posted 2015-11-14T12:40:24.093

Reputation: 3 053

1

MathGolf, 5 4 bytes

Åîo▲

Try it online.

Thanks to @maxb for explaining how to do an infinite loop in MathGolf.

Explanation:

   ▲    # Do-while true by popping the value,
Å       # with two commands within the loop-body:
 î      #  Push the 1-indexed loop-index
  o     #  Print it with a trailing newline without popping

Note that just like in Python, a positive integer is considered truthy, which is why we print the loop-index without popping so the while(true) can continue.

Kevin Cruijssen

Posted 2015-11-14T12:40:24.093

Reputation: 67 575

1

Keg, 4 bytes

{!:.

Explanation

{    Forever:
 !   Push the length of the stack
  :. Print the number and repeat

Loop is implicitly ended

Try it online!

user85052

Posted 2015-11-14T12:40:24.093

Reputation:

You can save a byte by dropping the closing } – Lyxal – 2019-07-12T22:44:48.607

using the most recent interpreter? – Lyxal – 2019-07-13T03:32:39.373

1I was using an old interpreter... I updated my interpreter. – None – 2019-07-13T04:08:09.507

1

tinylisp, 33 bytes

(d f(q(l(f(a(h l)1)(disp(h l
(f 1

Try it online!

This is a golf of DLosc's answer, but different enough I thought it would deserve its own answer.

The interpreter fills out )s at the end of a line.

(d f (q vars body)) define f to be (q vars body), this form indicates to tinylisp f is a function taking as arguments vars returning body. vars is l in case, so all the arguments to f get put into a list and passed to l (had v been parenthesised, like (n) in DLosc's answer, f would be defined to only take 1 argument n).

The complete body is (f(a(h l)1)(disp(h l))) (3 trailing )s filled by tinylisp). This calls the function f with the arguments (a(h l)1) and (disp(h l)), which when called will let f see them through l as a list containing both of these arguments. (a(h l)1) adds 1 to (h l), the head of l. This is the counter. The second argument is (disp(h l)) which displays (h l) the head of l (the counter), and returns (). This second argument never gets used but using disp here allows the f to print every cycle.

The loop is started by (f 1) which calls f with l as the list of all the arguments, i.e. (1), the head of which is the counter.

user41805

Posted 2015-11-14T12:40:24.093

Reputation: 16 320

A variadic function! That's clever, I like it! – DLosc – 2019-12-18T20:42:01.977

1

05AB1E, 3 bytes

∞€,

Try it online!

tio.run truncates the input, but in theory this would count forever. Also on tio.run, there's a [ at the beginning, which I don't know how to get rid of.

Explanation

∞    # push infinite list ([1, 2, …, ∞])
 €   # pop a; apply next command for each in a
  ,  # pop a; print(a) (with newline)

Sagittarius

Posted 2015-11-14T12:40:24.093

Reputation: 169

You can get rid of the [ in the output by using the argument-flag --no-lazy. Has something to do with printing within a map with lazy-loading in Elixir, where 05AB1E is built in. But the --no-lazy will disable this lazy-loading, so you won't have this in the output. :) – Kevin Cruijssen – 2020-01-03T08:54:08.253

@KevinCruijssen oh, thanks! does it still count with the [? – Sagittarius – 2020-01-04T23:24:38.150

1

Python 3, 53 bytes

import itertools
for i in itertools.count(1):print(i)

Try it online!

Explanation

I prefer to avoid while loops in my code, therefore I decided to write the program.

import itertools                     # Pretty simple, import something
for i in itertools.count(1):         # Foreach in the infinite list from 1 to ∞
                            print(i) #     Print the current item

user85052

Posted 2015-11-14T12:40:24.093

Reputation:

Wow, that's rude. What did while loops ever do to you to deserve such hate? :P – Lyxal – 2020-01-05T03:08:10.020

Okay, that's better. Y'all know I was joking though? :P – Lyxal – 2020-01-05T04:04:01.220

1

PHP, 31 bytes

<?for(;;)echo$i=bcadd($i,1),~õ;

I assume default settings, as they are without an .ini (you may disable your local .ini with the -n option).


Sample Usage

$ php -n countup.php

primo

Posted 2015-11-14T12:40:24.093

Reputation: 30 891

You can save 2 bytes by saying they should run it using php -r '...', – Kenney – 2015-11-15T02:24:44.817

@Kenney r'' should cost three. It also seems to violate the constraint, "Your program must be a full, runnable program, and not a function or snippet." – primo – 2015-11-15T08:07:59.887

1As far as I am concerned, <? is at the templating level, and your code only really starts at for. It doesn't really say how the program is to be fed into the interpreter. But you're probably right! – Kenney – 2015-11-15T15:50:19.623

@Kenney the problem with that interpretation, is solutions that have anything outside the code tags, and also the use of <?=, e.g. http://codegolf.stackexchange.com/a/12569

– primo – 2015-11-16T00:53:30.643

do you need to use bcadd? If you're running it with -n then Notices aren't shown so you could get away with <?for(;;)echo++$i,~õ; – Doug McLean – 2015-11-17T22:39:49.967

In fact you get Notices with either version. Does bcadd help with the memory constraint perhaps? – Doug McLean – 2015-11-17T22:41:38.663

1@DougMcLean bcadd is necessary, because when the value exceeds PHP_MAX_INT, or the exactly representable floating point range (2^56), whichever comes first, it would fail to display an integer. – primo – 2015-11-18T02:29:00.370

Underscore or any letter as separator would save a byte. But both BC and GMP functions are not in the default installation. – Titus – 2016-12-06T14:21:48.210

1

Julia, 35 bytes

i=big(0);while 1>0 println(i+=1)end

This uses Julia's GMP-based arbitrary precision integers.

Alex A.

Posted 2015-11-14T12:40:24.093

Reputation: 23 761

1

VB.NET, 113 99 bytes

Well, pretty straightforward for .NET Framework 4. Needs a reference to System.Numeric.dll:

Module m
Sub Main
Dim i As Numerics.BigInteger
do
i+=1
Console.WriteLine(i)
loop
end sub
End Module

Not exactly original, but hey, even not that much longer than the C# answer ;-)

Thanks Berend for making me dig a little deeper into the compilation process, saving 14 bytes in the process.

Jens

Posted 2015-11-14T12:40:24.093

Reputation: 191

You can remove System. (twice), for an extra 14 bytes. – Berend – 2015-11-16T10:28:29.607

@Berend No I can't. It may work when compiled in Visual Studio due to automatic namespace imports, but I consider that cheating ;-) Here I would need to add Imports System to the code, which adds the 14 bytes right back in – Jens – 2015-11-16T12:51:53.970

How do you compile then? Both Visual Studio (2013) and MSBuild don't care about the missing system. – Berend – 2015-11-16T12:59:54.300

I plug the code above directly into the codedom compiler. Figured it is the most "raw" form of compiling vb.net. Sounds like a meta discussion in all honesty :) – Jens – 2015-11-16T13:05:41.723

okay I get your point. I don't use VB very often so I missed the Imported Namespaces option. – Berend – 2015-11-16T13:10:45.463

@Berend Ok I have dug a little deeper and found that Roslyn indeed imports 4 namespaces by default in every compilation, including System. The others are Microsoft.VisualBasic, System.Linq and System.Xml.Linq. So you are indeed correct and I can remove the System statements. I don't know what the Codedom compiler does then... – Jens – 2015-11-16T15:07:58.070

This discussion should probably be taken elsewhere, but anyway... The vbc compiler (vbc.exe /r:System.Numerics.dll MyModule.vb), insists on specifying System.Numerics.BigInteger, but it is fine with just Console.WriteLine(). – Berend – 2015-11-17T08:37:29.710

1Maybe a silly question, but as requirements are at least 2^128 ; does BigInteger really required ? if not, you could gain an extra 22 bytes by declaring i with Dim i# (using double identifier type character) – Sehnsucht – 2015-11-18T02:49:21.620

Agree with Sehnsucht, this could be 77 byte by using double. Here's a TIO link showing it working.

– Notts90 supports Monica – 2017-05-25T12:45:46.170

1

C++, 104 bytes

#include<cstdio>
int a,c[50]={-38};int main(){for(a=49;++c[a]>9;c[a--]=0);for(b:c)putchar(b+48);main();}

A translation of my C answer. This uses a terse range-based for loop, which is a C++1z feature briefly added to some compilers but later voted out of C++17. clang++ 3.5.2 compiles my code fine, but I'm not sure if it counts as "C++". I can change it to for(int b:c) if it's deemed invalid.

Lynn

Posted 2015-11-14T12:40:24.093

Reputation: 55 648

1

Go, 104 99 95 bytes

package main
import."math/big"
func main(){a:=&Int{}
for{println(a.Add(a,NewInt(1)).String())}}

Not terribly golfed yet, I might take the time to refine it later.

Note that this will not run on the playground since it runs forever.

Kristoffer Sall-Storgaard

Posted 2015-11-14T12:40:24.093

Reputation: 489

1

Python 2, 24 bytes

Same method as the Python 3 answer.

i=1
while 1:print i;i+=1

mbomb007

Posted 2015-11-14T12:40:24.093

Reputation: 21 944

1

Matlab, 95 bytes

   for n=1:128;sym(sym(2^n)-1),for i=1:n sym(2^n+sym(sum(power(2,nchoosek(1:n,i)-1),2)-1)),end,end

  • This program can count over 2^128 just try with these parameters if you have doubts.

    for n=200:200;sym(sym(2^n)-1),for i=1:n sym(2^n+sym(sum(power(2,nchoosek(1:n,i)-1),2)-1)),end,end
    
  • This can be golfed more if I could figure out a way to combine two loops in one single executive loop, thats because the code skips one integer per 2^k the case of one loop.

Abr001am

Posted 2015-11-14T12:40:24.093

Reputation: 862

1

UberGenes, 33 30 bytes

I'm giving two versions here, just to demonstrate the lang. Integers and memory in UberGenes are bounded only by computer memory, so both versions meet the "forever" requirement. This first one is for score:

=ii+a1=pa=q5=bi-p1=oQ:bp=oI=i0

It prints numbers in unary separated by '=' characters. Explanation (indents indicate a loop start):

=ii                                  NOP
   +a1                               INC a (initially 0)
   =pa                               COPY a INTO p
   =q5                               SET q=5 so it points to '1'
   =bi                               SET b to this location (15)
      -p1                            DEC p
      =oQ                            OUTPUT '1'
      :bp                            JUMP to b's location while p>0
   =oI                               OUTPUT the contents of this location ('=')
   =i0                               JUMP to the beginning of main loop.

The second version is more interesting (66 bytes):

=ii+a1=l0-l2=pa=z8*z6=t5*t2=bi=qp%qt+qz=Lq-l1/pt:bp=bi=oL+l1:bL=i0

It prints the numbers in decimal separated by NULLs.

How it works (indents indicate a loop start):

=ii                                  NOP
   +a1                               INC a (initially 0)
   =l0-l2                            SET l=-2
   =pa                               COPY a INTO p
   =z8*z6                            SET z=48 ('0')
   =t5*t2                            SET t=10
   =bi                               SET b to this location (27)
      =qp                            COPY p INTO q
      %qt                            MOD q BY 10
      +qz                            ADD 48 to q (turn it into character)
      =Lq                            PUT q AT MEM[l]
      -l1                            DEC l
      /pt                            DIVIDE p by 10
      :bp                            JUMP back to b's location if p>0
   =bi                               SET b to this location (51)
      =oL                            OUTPUT the character in MEM[l]
      +l1                            INC l
      :bL                            JUMP back to b's location if MEM[l]>0
   =i0                               JUMP back to beginning of main loop

quintopia

Posted 2015-11-14T12:40:24.093

Reputation: 3 899

1

Mouse-2002, 17 bytes

aa:(a.!"!"a.b+a:)

It seems there's a flaw in the interpreter which messes up using the stack for while loops, I dunno, so we use a variable instead.

cat

Posted 2015-11-14T12:40:24.093

Reputation: 4 989

1

Forth, 67 71 bytes

Forth doesn't have a builtin word for exponentiation, so we need to define one, because loops in Forth, which are frowned upon, need clearly defined bounds.

According to the language's original spec, this will segfault or run out of memory when it gets to 32,767 but that's not the case for mighty gforth! Instead, this runs out of memory whenever it's unable to continue storing numbers, as the stack's allocation is not dynamic like the heap's is, and do's operands (the limit and index) are put on the heap, not the stack, else they would interfere with the stack.

Essentially, it will stop at the same point every other answer here will.

The loop construct normally looks like 10 0 do ... loop where 10 is the limit and 0 is the index, i.e starting point.

In this example, we need to add one to the upper bound before counting there.

Edit: apparently do is a "compile-only" word, and it can only be found inside macro definitions.

: p over swap 1 ?do over * loop nip ;
: c 2 128 p 1 + 0 do i . loop ;
c

cat

Posted 2015-11-14T12:40:24.093

Reputation: 4 989

1

Y, 9 bytes

0C:' gghX

Simple three-link program. 0C initializes the stack with a 0 and moves to the next link, : duplicates the current value ' pushes a space for a separator, gg prints twice, and h increments it. X is an unconditional wrap-around, so we go to the beginning of the link. Try it here!

Conor O'Brien

Posted 2015-11-14T12:40:24.093

Reputation: 36 228

1

D, 56 57 bytes

import std.stdio;void main(){for(real i;;writeln(i++)){}}

Pretty straightforward. D != Python.

The shortest while-loop version I can think of is longer, at 59 bytes:

import std.stdio;void main(){real i;while(++i){writeln(i);}}

cat

Posted 2015-11-14T12:40:24.093

Reputation: 4 989

1

ForceLang, 35 bytes

label l
io.writeln set a 1+a
goto l

ForceLang uses BigRationals as the default number type.

Also, in the latest revision, 1+nil yields 1, which is what allows this version to work (previously it would have yielded the string "1<nil>".)

nil+1, however, still triggers a null pointer exception.

SuperJedi224

Posted 2015-11-14T12:40:24.093

Reputation: 11 342

1

APL (Dyalog APL), 13 14 10 bytes

{1+⎕←⍵}⍣≡0

Try it online!

Adám

Posted 2015-11-14T12:40:24.093

Reputation: 37 779

1

Molecule, 7 bytes (6 chars)

0(1+~)

Explanation:

0(1+~)
0      add 0 to stack
 (     begin while statement
  1+   add one
    ~  print
     ) goto the beginning of while statement.

user47018

Posted 2015-11-14T12:40:24.093

Reputation:

1

Perl 6, 13 bytes

.say for 0..*

Perl 6 has lazy/infinite arrays, so I'm abusing that to create an infinite range. This will never run out of memory.

Note: as explained in the Perl 6 docs, (0..*)>>.say would print out of order.

Ven

Posted 2015-11-14T12:40:24.093

Reputation: 3 382

1

AutoHotKey, 34 bytes

Golfed and Ungolfed is the same.

Golfed:

c:=0
Loop {
    c:=c+1
    tooltip %c%
}

Ungolfed:

c:=0
Loop {
    c:=c+1
    tooltip %c%
}

Michelfrancis Bustillos

Posted 2015-11-14T12:40:24.093

Reputation: 695

not that it's a problem, but if golfed and ungolfed are the same why would you bother with both of them – undergroundmonorail – 2016-04-25T15:12:54.677

also does ahk really enforce indentation like that? it's been a long time since i used it, i don't remember – undergroundmonorail – 2016-04-25T15:13:23.147

It does, and the golfed and unfolded are just a universal format I use (I save each of my entries). – Michelfrancis Bustillos – 2016-04-25T17:05:23.327

1

JavaScript (ES6), 74 69 chars

Output is binary.

for(r="1";;r=r.replace(/(?:(^1)|.)(?=1*$)/g,(m,f)=>f?10:m^1))alert(r)

Qwertiy

Posted 2015-11-14T12:40:24.093

Reputation: 2 697

The question says you have to start counting from 1, not 0. – kamoroso94 – 2017-10-09T01:34:05.080

@kamoroso94, not a problem. Fixed it. – Qwertiy – 2017-10-09T07:08:16.027

1

Pyke, 5 3 bytes

ohr

Try it here!

Blue

Posted 2015-11-14T12:40:24.093

Reputation: 26 661

1

Node.js + Big.js, 63 bytes

Use npm install big.js before running.

c=new require("big.js")(0);while(1)console.log(c+""),c=c.add(1)

Simple enough, and has arbitrary precision. Each number is seperated by newlines.

Conor O'Brien

Posted 2015-11-14T12:40:24.093

Reputation: 36 228

1

Tellurium, 6 bytes

[i|+^]

Pretty simple.

The program adds one to the selected cell (+), and then outputs it (^). Using i as a loop's value makes it run the code forever.

m654

Posted 2015-11-14T12:40:24.093

Reputation: 765

Does tellurium have arbitrary length integers? – vrwim – 2016-05-20T14:13:05.367

@vrwim I'm not sure, I think it counts up to Python's maxint, which is 2147483647. – m654 – 2016-05-20T15:33:34.380

1

Lua, 27 Bytes

i=1::a::i=i+1print(i)goto a

Katenkyo

Posted 2015-11-14T12:40:24.093

Reputation: 2 857

1

Befunge - 4 bytes

I’m surprised there isn’t already a Befunge answer on here.

1+:.

Hactar

Posted 2015-11-14T12:40:24.093

Reputation: 646

0

Pushy, 4 bytes

1$#h

Non-competing as the language postdates the challenge.

1       % Push 1
 $      % While loop (see below):
  #     %   Output last item
   h    %   Increment last item

The while loop will keep running while the last value on the stack evaluates to true. Because all values except 0 are truthy in Pushy, this loop will never exit. The ; to end the loop is assumed by the interpreter.

This should eventually reach 2^128 as specified, because Pushy uses Python 3 (arbitrary sized) integers.

FlipTack

Posted 2015-11-14T12:40:24.093

Reputation: 13 242

0

PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

Titus

Posted 2015-11-14T12:40:24.093

Reputation: 13 814

0

tcl, 23

while 1 {puts [incr i]}

demo

sergiol

Posted 2015-11-14T12:40:24.093

Reputation: 3 055

0

stacked, 12 bytes

[1+out]0 ani

Try it online!

This works as follows:

[1+out]0 ani
[     ]0 ani   in an interval of 0 seconds, do:
 1+            add 1 to the counter
   out         output it

Conor O'Brien

Posted 2015-11-14T12:40:24.093

Reputation: 36 228

0

VBA, 157 103 bytes

The Variant / Decimal data type in VBA only allows up to 29 digits of precision. 2^128 is 39 digits long so we have to smoosh two variables together. Variant is the default for any undeclared variable so that's easy. Every time the right-hand side (a) rolls over, set it back to 0 and iterate the left-hand side (b) by 1. To handle leading zeros, we set the format to be 28 digits long the first time that a rolls over. This has a smaller max than the string method but it's well above 2^128.

Sub c()
Do
a=a+1
If a=10^28Then b=b+1:a=0:f=Replace(Space(28)," ",0)
Debug.?b &Format(a,f)
Loop
End Sub

Once it's formatted for humans, it looks like this:

Sub c()
    Do
        a = a + 1
        If a = 10 ^ 28 Then b = b + 1: a = 0: f = Replace(Space(28), " ", 0)
        Debug.Print b & Format(a, f)
    Loop
End Sub

Previous method using strings:
It starts with the right-most character, converts it to a number, and then keeps moving left until the result is less than 10.

Sub d()
s="1"
Do
Debug.?s
For i=Len(s)To 1Step -1
c=Val(Right(s,1))+1
s=Left(s,i-1)
If c<10Then Exit For
If i-1Then r=r &"0"
Next
s=s &c &r
r=""
Loop
End Sub

Engineer Toast

Posted 2015-11-14T12:40:24.093

Reputation: 5 769

I am curious to see if there may be a LongLong (64 bit int) data type solution for vba and this problem - though admittedly I cannot think of one at this time – Taylor Scott – 2017-03-31T07:50:47.237

@TaylorScott You were right, there totally was. I had thought it would be too awkward to squish them together but it ended up being shorter. – Engineer Toast – 2017-03-31T14:24:22.413

0

REXX, 34 bytes

numeric digits 39
do #=0
say #
end

(If your interpreter is set to a suitably large default precision, you may skip the numeric digits line.)

idrougge

Posted 2015-11-14T12:40:24.093

Reputation: 641

0

QBIC, 8 bytes

{n=n+1?n

Explanation:

{       Start an infinite loop
n=n+1   Increment n (starts at 0)
?n      PRINT n
        Loop closed implicitly

Runs better tan expected. QBIC, when run in QBasic 4.5 on DOSBOX handles numbers up to and including 2^128 quite well, but it has a tendency to use scientific notation for the bigger numbers.

steenbergh

Posted 2015-11-14T12:40:24.093

Reputation: 7 772

0

Fourier, 10 bytes

(i^~io32a)

A very simple program that loops forever.

Try it on FourIDE

Note, the program on FourIDE has been modified to make it more readable: it has a delay of two seconds between each number

Beta Decay

Posted 2015-11-14T12:40:24.093

Reputation: 21 478

Will this work up to 2^128? – a spaghetto – 2017-05-01T18:37:01.677

@quartata I would have thought so – Beta Decay – 2017-05-01T19:06:35.993

0

Braingolf, 15 bytes [non-competing]

V# R1[l!_v!@R>]

Explanation:

V# R1[l!_v!@R>]
V               Creates new stack and switches to it
 #<space>       Pushes 32 (ASCII value of a space) to stack
   R            Return to main stack
    1           Push 1
     [........] do-while loop. Will always run once, then checks if 
                first value in stack is 0 after each loop, if it is,
                breaks out of the loop
      l         Push current length of stack
       !_       Print last item on stack without popping
         v      Switch to next stack
          !@    Print last item on stack as ASCII char without popping
            R   Return to main stack
             >  Move last item to the start of the stack

Skidsdev

Posted 2015-11-14T12:40:24.093

Reputation: 9 656

0

Groovy, 25 bytes

for(i=1g;;i++){println i}

Try it online!

Groovy allows numeric literals of type BigInteger or BigDecimal to be declared by using the suffix g. BigNumber types are arbitrary length/precision numbers. This code declares a BigInteger then continuously prints (with a newline) and increments it.

Ephphatha

Posted 2015-11-14T12:40:24.093

Reputation: 581

0

Check, 13 bytes

 >1#v
#<)##p#

Check is my new esolang. It uses a combination of 2D and 1D semantics.

Esolanging Fruit

Posted 2015-11-14T12:40:24.093

Reputation: 13 542

0

Jelly, 3 bytes

Non-competing as Jelly is newer than this challenge.

‘Ṅß

Try it online!

‘Ṅß
‘      Increment
 Ṅ     Print w/ linefeed
  ß    Call this link again

scatter

Posted 2015-11-14T12:40:24.093

Reputation: 874

2Wait there was actually never a Jelly answer on this before yesterday...?? Wow. But nice, +1! :D – HyperNeutrino – 2017-06-17T01:57:01.640

0

Anyfix, 6 bytes

This was intended to be a language that allowed programs to be prefix, infix, and postfix, sometimes all at once. However, because of the way it works, dyads and tryads will default to prefix and monads will default to postfix. It's quite confusing. (Inspired by Jelly and 05AB1E)

1¿"Ƥ‘»

Explanation

1¿"Ƥ‘»  Program
1         Push 1 onto the stack
 ¿       If the stack is non-empty, then look at the top of the stack off and execute the next token if that value is truthy
  "Ƥ‘"»  ComboToken:
  "      Duplicate the top of the stack
   Ƥ     Pop and print with a trailing newline
    ‘    Increment the value

Since this is written in Python, it can easily count up to way past 2 ** 16384... hehe

This language will be on TIO sometime in the future once Dennis has some time to spare.

HyperNeutrino

Posted 2015-11-14T12:40:24.093

Reputation: 26 575

0

8th, 31 bytes

Code

: f n:1+ dup . cr recurse ; 0 f

Chaos Manor

Posted 2015-11-14T12:40:24.093

Reputation: 521

0

Casio Basic, 27 bytes

For 1⇒z To ∞
Print z
Next

The largest integer the fx-CP400 can store precisely is a bit over 22032, or 611 digits. Chances are it'll keep counting up to 101000 before overflowing, though.

numbermaniac

Posted 2015-11-14T12:40:24.093

Reputation: 639

0

Cubically, 12 11 bytes

R3D1R1(+0%6)

Explanation:

R3D1R1       get UP's faceval to 1
      (      open loop that can always be jumped to
       +0     add 1 to notepad
         %    print notepad
          )  loop

MD XF

Posted 2015-11-14T12:40:24.093

Reputation: 11 605

0

Implicit on TIO, 6 4 bytes

(.%ß

This requires that the input box on TIO is empty.

(.%ß
(...   « loop while top of stack truthy                       »;
 .     «  increment top of stack (read input if stack empty)  »;
  %    «  print integer                                       »;
   ß   «  print space                                         »;
       « just kidding, loop forever                           »;

Try it online!

MD XF

Posted 2015-11-14T12:40:24.093

Reputation: 11 605

0

RProgN 2, 6 bytes

1]p1+{

Try it online!

ATaco

Posted 2015-11-14T12:40:24.093

Reputation: 7 898

0

Swift 4, 146 bytes

var a=[0];while true{var e=a.count-1;print(a.reduce("",{$0+"\($1)"}));while e>=0{a[e]+=1;if a[e]<10{break};a[e]=0;if e==0{a.insert(1,at:0)};e-=1}}

The code compiles as is from a .swift file using swiftc. The program outputs numbers in decimal form, and given enough time it will output 2128 (and beyond).

Ungolfed (and slightly modifieda) version: Swift Sandbox.


a: Starts just shy of 1040 (larger than 2128) and ends execution at 1040 exactly.

xoudini

Posted 2015-11-14T12:40:24.093

Reputation: 161

0

Husk, 1 byte

N

Try it online!

Erik the Outgolfer

Posted 2015-11-14T12:40:24.093

Reputation: 38 134

0

><>, 15 Bytes

0>1+:n\
 \og10/

Start with zero. Add one, print the value, and then print the character at (0,1) in the codebox, which is a space. Repeat ad nauseam.

Bolce Bussiere

Posted 2015-11-14T12:40:24.093

Reputation: 970

0

TrumpScript, 117 bytes

am is 1000001
an is 1000000
As long as,an is an?;:
say am minus an
am is,am plus 1000001 minus an;!
America is great.

Try it online!

What, there was no TrumpScript submission? Well, now there is. I don't think we can golf it any further though.

Luca H

Posted 2015-11-14T12:40:24.093

Reputation: 163

0

ALGOL 68 (Genie), 58 54 bytes

BEGIN LONG LONG INT a:=0;WHILE1=1DO print(a+:=1)OD END

Try it online!

KSmarts

Posted 2015-11-14T12:40:24.093

Reputation: 1 830

0

JavaScript (ES6), 56 Bytes, optimized from user81655

for(n=[],i=99;;)if(n[i]=-~n[i--]%10)alert(n.join``,i=99)

l4m2

Posted 2015-11-14T12:40:24.093

Reputation: 5 985

0

Pyt, 6 bytes

1`Đƥ⁺ł

Explanation:

1           Push 1
 `   ł      Loop while top of stack is not 0
  Đƥ        Duplicate top of stack, then print
    ⁺       Increment top of stack

Try it online!

mudkip201

Posted 2015-11-14T12:40:24.093

Reputation: 833

0

brainfuck, 31 bytes

->+>+[[<.+]->-[->-]+>[->]<[>]+]

Try it online!

Prints the binary value of each number with char code 1 as 1, null byte as 0 and ÿ as the separator.

The output is the exact same as the previous brainfuck answer, however this can go as high as 2^29998 in the 300000 available brainfuck cells and is 13 bytes shorter.

Jo King

Posted 2015-11-14T12:40:24.093

Reputation: 38 234

0

Ace, 4 bytes (non - competing)

vIPO

Try it online!

This is a new language I am working on, plan on it officially being a language by August 2018

FantaC

Posted 2015-11-14T12:40:24.093

Reputation: 1 425

0

tinylisp, 34 bytes

(d f(q((n)(i(disp n)1(f(a n 1
(f 1

The program defines a function f that takes one argument n, prints it, and recurses on n+1; then it calls f with an initial argument of 1. Because tinylisp has tail-call optimization, infinite recursion is not a problem--the implementation handles it as an infinite loop instead.

Try it online!

DLosc

Posted 2015-11-14T12:40:24.093

Reputation: 21 213

Got 33 bytes :)

– user41805 – 2019-12-06T18:14:38.430

0

Julia 0.6, 30 bytes

for i=1:big(2)^999 @show i end

Outputs lines like i = 1, i = 2. If the i = is disallowed, then for i=1:big(2)^999 println(i) end is 32 bytes. This will count to 2^999, well over the 2^128 required. You can increase that significantly with no additional bytes with big(2)^9^9 but it times out in TIO. big(2) is an arbitrary precision integer, and all math with smaller integer types promotes to arbitrary precision.

Try it online!

gggg

Posted 2015-11-14T12:40:24.093

Reputation: 1 715

"Your program must count at least as far as 2^128 (inclusive) without problems and without running out of memory on a reasonable desktop PC. In particular, this means if you're using unary, you cannot store a unary representation of the current number in memory." While the title says forever, the rules do not. Also 2^9^9 is still longer than the age of the universe if you count at one tick per femtosecond. – gggg – 2018-01-29T16:38:15.520

My bad, I didn't read through the challenge enough I guess. – MD XF – 2018-01-29T17:41:23.057

0

Forked, 5 bytes

1+%A!

Try it online!

  • 1 - push 1
  • + - add top two stack value together
  • % - print top of stack as integer
  • A - push 10 (ASCII newline)
  • ! - print as ASCII and pop

Forked is two-dimensional and the IP wraps, so this loops infinitely.

MD XF

Posted 2015-11-14T12:40:24.093

Reputation: 11 605

0

rk, 22 bytes

int i
a-
print: ++ i
a

Requires the -e flag. Try it online!

Ungolfed:

rk:start
  int i
  while 1 do
    print: ++ i
  done
rk:end

The golfed version uses gotos (goto_name- to declare, goto_name to goto).

MD XF

Posted 2015-11-14T12:40:24.093

Reputation: 11 605

0

Yabasic, 14 bytes

Script that counts from 0 to 2^1024 then outputs Inf, infinitely. Takes no input and outputs to the console.

Do?i
i=i+1Loop

Try it online!

Far More Interesting Version, 20 bytes

For some reason, 0/0=2^1024 in Yabasic, and the language appears to have no loss of precision on this range so rather than producing an error, the following code counts exactly from 0 to 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368, which is wonderful, and stupid :P

For i=0To 0/0?i
Next

Try it online!

Taylor Scott

Posted 2015-11-14T12:40:24.093

Reputation: 6 709

0

MY-BASIC, 27 bytes

While 1
i=i+1
Print i;
Wend

Try it online!

Taylor Scott

Posted 2015-11-14T12:40:24.093

Reputation: 6 709

0

uBASIC, 16 bytes

Anonymous function that takes no input and increments and outputs i forever. Note that the trailing newline is required for this code segment to function

1?i:i=i+1:GoTo1

Try it online!

Taylor Scott

Posted 2015-11-14T12:40:24.093

Reputation: 6 709

0

Visual Basic .NET (.NET Core), 76 bytes

Declared subroutine that takes no input, and increments then outputs i forever.

Module M
Sub Main
Dim i
Do
i+=1
Console.WriteLine(i)
Loop
End Sub
End Module

Try it online!

Taylor Scott

Posted 2015-11-14T12:40:24.093

Reputation: 6 709

0

Foam, 22 bytes

0[[+1 : <#]/-\ : ~]: ~

Esolanging Fruit

Posted 2015-11-14T12:40:24.093

Reputation: 13 542

0

Noether, 6 bytes

(!iP?)

Try it online!

The online link has a delay of 1 second added to prevent the interpreter from freezing up.

Beta Decay

Posted 2015-11-14T12:40:24.093

Reputation: 21 478

0

Momema, 17 bytes

z00+1*0-8*0-9 9z1

Try it online!

Esolanging Fruit

Posted 2015-11-14T12:40:24.093

Reputation: 13 542

0

Python3, 32 bytes

list(map(print,range(1,2**128)))

Too bad this is longer than the other python solutions...

Aneesh Durg

Posted 2015-11-14T12:40:24.093

Reputation: 239

0

JavaScript (ES6), 22 bytes

for(i=0n;++i;)alert(i)

This uses BigInts, which can go to high integers without losing accuracy. Per earlier submissions, I'm assuming that using alert, with its automatic separation between popups, means that outputting an extra character is not necessary.

Yair Rand

Posted 2015-11-14T12:40:24.093

Reputation: 381

0

Tamsin, 27 26 bytes

main=''->T&{print a+T->T}.

Prints in Unary.

Try it online!

Esolanging Fruit

Posted 2015-11-14T12:40:24.093

Reputation: 13 542

0

Wolfram Language (Mathematica), 18 bytes (16 characters)

Print@i~Do~{i,∞}

Try it online!

Roman

Posted 2015-11-14T12:40:24.093

Reputation: 1 190

0

Wren, 32 bytes

Generates a range between -1 and Not A Number(an unaccessable number that could be generated by 0-division). For every item output the number negated.

for(i in-1..0/0)System.print(-i)

Try it online!

Explanation

        -1..                     // Generate a range from -1 to ...
            0/0                  // ... the "nan" number (all we know
                                 // is that this number is negative infinity)
for(i in       )                 // Iterate this range using a for loop
                                 // with the i item set for every item
                System.print(  ) // Output ...
                             -i  // the number negated (counts from 1
                                 // to positive infinity)

Wren, 35 bytes

var n=0
while(n)System.print(n=n+1)

Try it online!

Explanation

var n=0 // Create a new variable set to 0
while(n) // While n is an integer:
        System.print(     ) // Output
                       n+1  // the variable incremented by 1
                     n=     // Set this value to n

user85052

Posted 2015-11-14T12:40:24.093

Reputation:

0

W, 3 bytes

iaE

Explanation

W allows infinite lists, so this simply loops over the infinite list.

i   % Unsurprisingly, a built-in for positive infinity.
  E % Foreach the infinite list
    % from 1 to infinity:
 a  % Print this item
    % with a newline

user85052

Posted 2015-11-14T12:40:24.093

Reputation:

0

PowerShell, 19 14 Bytes

for(){$i++;$i}

Removed echo as per user recommendation

Chad Baxter

Posted 2015-11-14T12:40:24.093

Reputation: 248

3Is $i really going to have an inferred type which goes as far as 2^128? – Peter Taylor – 2015-11-16T19:38:38.677

@PeterTaylor I had no idea how big 2^128 was until this challenge was posted. @Chad Baxter for shortening output, you can leave off echo. – Booga Roo – 2015-11-16T21:14:37.647

Powershell is very good at making sure the memory space is large enough. If it won't fit in a 32 bit int, it will automatically convert it to a 64bit int...for anything higher it autoconcatenates – Chad Baxter – 2015-11-16T21:54:07.443

So technically it will only fill two Int64 to meet requirements...but it can go higher – Chad Baxter – 2015-11-16T21:57:39.033

On my system, PowerShell doesn't convert to [int64], it converts to [double]. Eventually [double] starts displaying in scientific notation once it reaches 16 digits which doesn't meet the display requirements. Are you sure $i is getting converted to [int64] on your system? – Booga Roo – 2015-11-17T02:27:07.483

Hmmm I'm using powershell v5 which converts to int64 weird...I'll look into it – Chad Baxter – 2015-11-17T02:48:10.293

I'm also using PowerShell 5(April 2015 preview with .Net 4.5.2). My system also converts int64 to double once it goes over 9223372036854775807. – Booga Roo – 2015-11-17T05:00:47.223

I'm gonna see if I can squeeze in a LONG converter – Chad Baxter – 2015-11-17T12:36:35.030

1Once you figure out the conversion to allow 2^128 (I'm not sure it's possible without using [bigint]), you can save a couple bytes by doing (++$i) instead of $i++;$i -- the prepending ++ ensures we start at 1, and enclosing in parens () will automatically output, since it's left on the pipeline alone. However, if you need [bigint], ignore this recommendation. – AdmBorkBork – 2015-11-25T14:15:26.877

0

Pylongolf2, 6 bytes

0>1+~<

Have a zero in the stack and continously add up to it.
I could give a more detailed explanation.

Pylongolf2, 20 bytes (bonus)

cn:A0>1+~_A@1=?t¿d<

Only works in beta 6, but this version asks for what number to count to.

user47018

Posted 2015-11-14T12:40:24.093

Reputation:

0

PRINDEAL, 21

a c 
 i n 
 r 
 c
a r 
 p n 
 c 
 r

Preceds each number printed with n =, because it is not possible to print without such a prefix in PRINDEAL.

pppery

Posted 2015-11-14T12:40:24.093

Reputation: 3 987

0

PostL Non-competing, 13 bytes

Non-competing since this language postdates the challenge, and it can't quite count up to 2128

1C_'\n'_1+1;>
1             Push 1 onto the stack
 C            Copy the top of the stack
  _           Pop the top of the stack and output it
   '\n'       Push a newline onto the stack
       _      Pop the newline and output it
        1+    Add 1 to the top of the stack (which is the current number)
          1;> Goto index 1

HyperNeutrino

Posted 2015-11-14T12:40:24.093

Reputation: 26 575

-1

C#, 83 Bytes

using System;class C{static void Main(){double x=0;for(;;)Console.WriteLine(x++);}}

Un-golfed:

using System;
class C {
  static void Main(){
    double b=0;
    for(;;)Console.WriteLine(b++);
  }
}

Note: C#'s double type can store values up to approximately 1.79769313486232x10308.

EnragedTanker

Posted 2015-11-14T12:40:24.093

Reputation: 309

9007199254740992 is the last integer to which you can increment safely that can be represented in a double. Try this code: 9007199254740992.0 == 9007199254740992.0 + 1 - Spoiler alert: it evaluates as true. – Theraot – 2017-05-27T15:03:41.493

-1

C++, 72 bytes

Different from the other C++ answer, as it only uses the std library.

Golfed:

#include<iostream>
int main(){for(int c=0;c>=0;c++,std::cout<<c<<"\n");}

Ungolfed:

#include<iostream>
int main(){
    for(int c = 0; c >= 0; c++){
        std::cout<<c<<"\n";
    }
}

Michelfrancis Bustillos

Posted 2015-11-14T12:40:24.093

Reputation: 695

Save one byte by deleting the space before for :) – Leaky Nun – 2016-04-25T14:14:26.810

Does for(int c=0;c>=0;c++,std::cout<<c<<"\n"); work? – Leaky Nun – 2016-04-25T14:15:46.350

@KennyLau Yes, indeed it does. – Michelfrancis Bustillos – 2016-04-25T14:37:24.250

This is not valid, because it needs to be able to count to at least 2^128, and int is not going to be that big. – Esolanging Fruit – 2018-08-17T06:40:26.537