It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.
This is not the same thing. That one is about counting up indefinitely.


Write a program or function that prints every integer from 1 to n inclusive.


  • You can get n any way.
  • You can assume that n will always be a positive integer.
  • You can get n in any base, but you should always output in decimal.
  • Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).
  • Standard loopholes are denied.
  • We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.
  • You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).
  • You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.



  • Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

  • 6
    \$\begingroup\$ Related. \$\endgroup\$ – Martin Ender Apr 25 '16 at 12:20
  • \$\begingroup\$ "You can get n any way." Does that mean we can assume n to be saved in a variable? \$\endgroup\$ – flawr May 21 '16 at 20:50
  • \$\begingroup\$ @flawr You can get n any way. You can save it in a variable, but it must not be hardcoded. \$\endgroup\$ – Erik the Outgolfer May 22 '16 at 10:26
  • \$\begingroup\$ It might be useful to link to the accepted I/O methods \$\endgroup\$ – Ephphatha Jun 2 '17 at 12:26
  • \$\begingroup\$ @Ephphatha Yes it probably is, this challenge is from the old times where I was an utter newb. \$\endgroup\$ – Erik the Outgolfer Jun 2 '17 at 12:29

130 Answers 130


JavaScript (ES6), 84 80 bytes


Input is a string. Outputs as alert. Change alert to console.log if you want to keep your sanity.

I tried a few different methods then went to the print to infinity question to see how the JS answer there did it and found that I was the one who answered it. *facepalm* This approach is actually shorter though, so it worked out fine.


Hoon, 13 bytes

(cury gulf 1)

++gulf returns a list containing the numbers from a to b. Returned a curried function with 1 for a.


> %.  9
  (cury gulf 1)
~[1 2 3 4 5 6 7 8 9]
  • 1
    \$\begingroup\$ I read this as "curry golf" :P \$\endgroup\$ – Downgoat Apr 27 '16 at 21:57

JavaScript (ES6), 99 103

String increment using regexp, not limit except the string length
Edit 1 byte saved thx @user81655

x=>{for(a='';a!=x;console.log(a=(' '+a).replace(/.9*$/,x=>++x[0]+'0'.repeat(x.length-1)).trim()));}


f=x=>{for(a='';a!=x;console.log(a=(' '+a).replace(/.9*$/,x=>++x[0]+'0'.repeat(x.length-1)).trim()));}


function test() {
  var v = I.value
  if (/^\d+$/.test(v)) f(v)
  else console.log('Invalid number' + v)
  if(o.length > 30) o.splice(15,o.length-30,'','...','');

<input id=I value=10000><button onclick='test()'>go</button>
(this test snippet will show just the first and last 15 lines of the output)
<pre id=O></pre>

  • \$\begingroup\$ Interesting approach. I think you can use a='' at the start because the added space works as a 0 anyway. \$\endgroup\$ – user81655 Apr 26 '16 at 14:46
  • \$\begingroup\$ I think you can omit the last semicolon. \$\endgroup\$ – Erik the Outgolfer Jun 18 '16 at 9:25
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ you can't, a for statement needs a body \$\endgroup\$ – edc65 Jun 18 '16 at 9:54
  • \$\begingroup\$ @edc65 Like when the last statement does not need the semicolon... \$\endgroup\$ – Erik the Outgolfer Jun 18 '16 at 9:55
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ ??? (anyway, try it, it won't work) \$\endgroup\$ – edc65 Jun 18 '16 at 10:01

AWK, 25 23 Bytes


It seems like I should be able to make this smaller, but I can't seem to figure out how. :(

OK, I must have been asleep not to realize I could drop those braces... thanks Olivier.

An example usage would be to store this code in a file, FILE then do something along the lines of:

awk -f FILE <<< 4242342
  • 2
    \$\begingroup\$ Not initialising with j=0 is ugly but ok here. :-) \$\endgroup\$ – rexkogitans Apr 25 '16 at 15:02
  • \$\begingroup\$ should be "<$1" (you go from 0 to $1-1, as you ++ before you print). You can also drop the {} after while, as you only have 1 command : {for(;j<$1;)print++j} . But : $1 is not valid in awk.. you're mixing shell's variable and awk variables. If you want $1, you also need to add the awk "..." wrapping ... \$\endgroup\$ – Olivier Dulac Apr 25 '16 at 15:40
  • \$\begingroup\$ @OlivierDulac I can't use <$1 since j starts at 0, the first ++ gets it up to 1, so I need the <=. I didn't think I would need the awk "..." part since this could simply be placed in a file and called however you like (essentially like compiling a file in other languages). E.g. awk -f FILE <<< 21657 \$\endgroup\$ – Robert Benson Apr 25 '16 at 17:27
  • \$\begingroup\$ @rexkogitans I agree that not initializing j=0 is ugly and I would never do it in production code... but this is PPCG :) \$\endgroup\$ – Robert Benson Apr 25 '16 at 17:28
  • 2
    \$\begingroup\$ @RobertBenson: If you edit (gain 2 bytes by taking out the curly braces around the printf, for example, and include a note showing the way to invoke it (like the one in your last comment), you'll gain 2 bytes + I would be able to revert my downvote to a vote. (right now it's locked "until it is edited") \$\endgroup\$ – Olivier Dulac Apr 26 '16 at 6:55

C++14, 142 bytes

using namespace std;[](auto n)->list<decltype(n)>{list<decltype(n)>t(n);iota(t.begin(),t.end(),1);return t;};

This declares an anonymous lambda function which can be captured and subsequently called. The function returns a std::list containing values of the same type as n. The unsigned long long data type can be used on 64-bit machines to support the full 64-bit unsigned integer range (calling it like f(18446744073709551615ULL)).

Try it online

  • \$\begingroup\$ I think this is only valid in C++14, not C++11 \$\endgroup\$ – anatolyg Apr 27 '16 at 14:51
  • \$\begingroup\$ @anatolyg std::iota, std::decltype, long long and lambda functions were all added in C++11. \$\endgroup\$ – Mego Apr 27 '16 at 18:34
  • \$\begingroup\$ I mean, a lambda function with auto-typed argument. Isn't it new in C++14? \$\endgroup\$ – anatolyg Apr 27 '16 at 19:05
  • \$\begingroup\$ @anatolyg Oh, you're right, I forgot that generic lambdas weren't added until C++14. Fixing it now, thanks! \$\endgroup\$ – Mego Apr 27 '16 at 19:06
  • \$\begingroup\$ Do you need newline after std;? \$\endgroup\$ – Erik the Outgolfer Apr 29 '16 at 17:43

Dyalog APL, 1 byte

This has worked since the very first APL, back in the seventies:


No built-in (also always worked):


Cumulative sum +\ of input number of 1s.

Obviously you will need enough memory to contain the result. Here is a print loop to avoid memory full:


{return and print ⎕← 1+ argument } applied input times to 0.


PowerShell, 32 26 bytes

After reading the question thoroughly, I realized that my original answer does not support up to 2^64-1 since the range operator (..) in PS only supports 32bit integers.

Corrected answer:



Usage (save as count.ps1):

PS>count.ps1 8

Old method, supports only up to 2^32-1 taking input from the pipeline:


Since expressions are only allowed as the first element in the PowerShell pipeline, I have to wrap it in a foreach (%).


JAISBaL, 15 bytes



# \# enable verbose parsing #\
pushnum 1        \# push 1 onto the stack #\
store 0          \# store the top value of the stack into var0 #\
for              \# start for loop #\
    load 0       \# push the value in var0 onto the stack #\
    duplicate    \# duplicate the top value of the stack #\
    popoutln     \# pop the top value off a stack and print it with a new line #\
    pushnum 1    \# push 1 onto the stack #\
    add          \# add the top two values of the stack #\
    store 0      \# store the top value of the stack into var0 #\
end              \# end current language construct #\

JAISBaL Noncompeting Answers These answers are noncompeting because they use the "range" instruction, which I added because of this challenge. I did not add them specifically to complete this challenge, rather this challenge brought the need for a range instruction to my attention.

Manual output, 4 bytes: (Manual output because the output at the end of a JAISBaL program can be considered debug information, although it is always enabled)



# \# enable verbose parsing #\
pushnum 1    \# push 1 onto the stack #\
rangein      \# push an array containing all numbers in the range of the two numbers on the top of the stack, inclusivley #\
popout       \# pop the top value of a stack and print it #\

Implicit Output, 3 bytes:


Same concept as the manual output answer, just without the print instruction.

Instruction codes and testing compatible with JAISBaL-0.0.6

  • \$\begingroup\$ +1 for interest. Remember to +1 on challenges that you're interested in, and fav the most challenging ones. \$\endgroup\$ – Erik the Outgolfer Jul 25 '16 at 5:17

Sesos (non-competing), 3 bytes

Hexdump of generated binary file:

0000000: 16f8ce                                            ...

Size   : 3 byte(s)

Try it online!


set numin
set numout
sub 1
fwd 1
add 1
rwd 1
           ;implicit jnz

Brainfuck pseudocode: ,[->+.<]


><>, 10 bytes


Try it online!

Input should be on stack before execution. Can be done via command line by launching the program with the -v flag, I've yet to understand how/if this should be counted.


At each iteration we print the length of the stack followed by a newline (lnao), then if the length of the stack has reached the input number we end the program (:l(?;), otherwise we duplicate the top of the stack (which will bethe input number) and continue.


T-SQL, 61 bytes


I used a different technique than Pete Arden's SQL answer. I took my input from column i of pre-existing table t, per our IO standards.


    SET @+=1
    PRINT @
  • \$\begingroup\$ Wow...this is so terse for SQL. \$\endgroup\$ – Erik the Outgolfer Jun 30 '17 at 16:42

PHP, 26 bytes -20% = 20.8


run as pipe with -F.



prints one trailing delimiter; run as pipe with -nR.


k/kona, 3 Bytes



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  • \$\begingroup\$ Please seprate this answer. We don't want polyglots in this challenge. \$\endgroup\$ – Erik the Outgolfer Jun 7 '16 at 16:40
  • \$\begingroup\$ @Erik Kona is an open-source implementation of the proprietary k language - they're equivalent rather than separate \$\endgroup\$ – Simon Major Jun 8 '16 at 9:20
  • \$\begingroup\$ Doesn't "Kona" have less abilities than "K" then? \$\endgroup\$ – Erik the Outgolfer Jun 8 '16 at 9:47
  • \$\begingroup\$ Presently, yeah, but it's aiming to be a full implementation of k. At which point it's the same thing as with Cython, Jython or IronPython - it's all a matter of semantics. \$\endgroup\$ – Simon Major Jun 8 '16 at 19:27
  • \$\begingroup\$ I prefer to be notified (and no, @Erik is not a notification, use @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ instead), not the last commenter. @SimonMajor \$\endgroup\$ – Erik the Outgolfer Jun 9 '16 at 6:41

Excel VBA, 48 47 46 22 21 Bytes

Immediates Window Function

Anonymous VBE Immediates Windows Function that takes input of the expected type Variant\Integer and from cell [A1] outputs to the VBE immediates window

For I=1To[A1]:?I:Next

Old Subroutine Version


Sub F(N):For I=1To N:Cells(I, 1)=I:Next:End Sub


Sub Test(): F 100: End Sub


-24 Bytes for converting to Immediates Window Function

-1 Byte for condensing I=1 To to I=1To

-1 Byte thanks to Engineer Toast for Changing Cells(I,1) to Debug.?

-1 Byte for removing whitespace

Output to ActiveSheet, 30 28 Bytes

Anonymous VBE immediate window function that takes input from range [A1] and outputs to the range [1:1]


-2 Bytes for removing A1 from Row(A1)

  • 1
    \$\begingroup\$ You can save 5 bytes by switching from Cells(I, 1)=I to Debug.?I \$\endgroup\$ – Engineer Toast Mar 29 '17 at 19:10
  • 1
    \$\begingroup\$ Also, this only works up to a certain point before VBA cuts off the significant digits. After that, iterating by 1 won't work because it'll truncate it and return the same value. \$\endgroup\$ – Engineer Toast Mar 29 '17 at 19:32
  • \$\begingroup\$ @EngineerToast I have corrected this, thanks for pointing it out :) \$\endgroup\$ – Taylor Scott Mar 30 '17 at 2:57

Stack Cats with -nl, 18 bytes


Try it online!

Flags are not counted as bytes, but as a separate language as per this Meta consensus.


  • -n to do integer I/O
  • -l to implicitly mirror to the left; the actual code is <(*]{[:!-_:>}<[<)*(>]>{<:_-!:]}[*)>.

Adapted from this answer for printing out 1 to 10. I had to fall back to the <(...)*(...)> structure to handle the input correctly. (I once tried _(...)_(...)_ instead, but I realized it is incorrect for n=1.)

How it works:

     [-1 n*]
<    [*] [-1 n]
(..) Skip
*    [1*] [-1 n]
>]>  [1] [-1] [n] [*]
{    Remember 0
<:   [1] [-1] [n 0*] [...]
_-!  [1] [-1] [n n-1*] [...]
:]   [1] [-1] [n-1] [... n*]
}    Exit if top is 0
[    Remove 0 at the top
*    Make the top positive
)    Top = 1; exit
>    Return to the stack of numbers
  • \$\begingroup\$ -nl is not "+4", and this isn't Stack Cats, but Stack Cats +O: -nl (you aren't forced to this specific header). \$\endgroup\$ – Erik the Outgolfer Mar 13 '18 at 10:00
  • \$\begingroup\$ @EriktheOutgolfer I'm just following the answers by Martin Ender and Sp3000, and I haven't seen any other submission using that kind of header. \$\endgroup\$ – Bubbler Mar 13 '18 at 23:12
  • \$\begingroup\$ True, it's a new consensus, ~1 month old or something IIRC. You're not required to put that all in the header though, if it feels uncomfortable. \$\endgroup\$ – Erik the Outgolfer Mar 13 '18 at 23:20

Jelly, 1 byte


Try it online!


AutoHotKey, 58 bytes

Golfed and ungolfed are the same.



InputBox, x
while c<x{
    tooltip %c%
  • 1
    \$\begingroup\$ Are you sure you need:=0 and not just =0 \$\endgroup\$ – downrep_nation Apr 26 '16 at 6:49
  • \$\begingroup\$ @downrep_nation Yes \$\endgroup\$ – Michelfrancis Bustillos Apr 27 '16 at 13:36

J, 4 bytes


Try it online!

  • 1
    \$\begingroup\$ (sorry fo the late comment) but don't you need some form of x:? \$\endgroup\$ – Conor O'Brien Jun 6 '16 at 19:09

Bash, 17 bytes

eval echo {1..$1}
  • 2
    \$\begingroup\$ I'm not sure you can count up to 2^64 (or even quite a bit less) ? \$\endgroup\$ – Olivier Dulac Apr 25 '16 at 15:50
  • 1
    \$\begingroup\$ Isn't this limited by the maximum length of command line which is unlikely to gain 2^64 times average length of numbers? \$\endgroup\$ – rexkogitans Apr 26 '16 at 20:58
  • 1
    \$\begingroup\$ @rexkogitans The ARG_MAX constant is a kernel limit for the exec() system call, but echo is a Bash built-in, so no exec() is involved, and thus you can build the argument list to fill up available memory if you like. Unfortunately, this solution does precisely that. But given enough time and memory, it works up to the maximum number allowed in arithmetic expressions, which seems to be only 2^32-1 on OSX Yosemite (Bash 3.2) but should work up to the specified limit with newer versions. \$\endgroup\$ – tripleee Apr 27 '16 at 4:53
  • \$\begingroup\$ @tripleee, yes it was exactly ARG_MAX I was thinking of, but this solution only expands the string twice. So, no reason for ARG_MAX. However, it loads the entire output into memory first (could become a problem with higher values). \$\endgroup\$ – rexkogitans Apr 27 '16 at 6:38
  • \$\begingroup\$ eval "echo -e \"\n\"{1..$1}" to separate numbers with a newline. \$\endgroup\$ – Yeti May 21 '16 at 22:12

J - 27 bytes

9!:37[0 _ _ _


   (,~<:@{.)^:<: 20x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


This avoids using the built-in i. to generate a range.

First, J will truncate output if it's too long, so we disable that by setting the values to infinity _

9!:37[0 _ _ _

Second, the input has to be given as an extended integer, which can be done by marking it with a suffix of x.

The actual function is only 13 bytes, the change in settings another 13 bytes, and the newline between them is a byte, so 13 + 1 + 13 = 27.

           <:    - Decrement the input
         ^:      - Repeat the given verb that many times, nesting its calls
      {.         - Take the head of the input
   <:            - Decrement it
 ,~              - Prepend it to the input

Befunge, 21 bytes

&>:  v

Counts down on the stack, then counts up. Compliance to the 2^64 rule may depend on implementation.

  • \$\begingroup\$ Rule is 2^64-1 because I was forced to deny standard loopholes. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 8:20

PHP, 32 bytes

for(;$i!=$argv[1];)echo++$i." "; 

57 Bytes

$c=function($e){$i=0;while($i!=$e)echo ++$i." ";};$c(10);

  • \$\begingroup\$ i just wish some would make a CG version of php just change reserved words into letters E.G function = func,while = w for = f foreach = fe \$\endgroup\$ – Martin Barker Apr 25 '16 at 14:30
  • \$\begingroup\$ I want it starting at 1. \$\endgroup\$ – Erik the Outgolfer Apr 25 '16 at 16:06
  • 1
    \$\begingroup\$ You can trim your solution down to 32 bytes: for(;$i!=$argv[1];)echo++$i." ";. \$\endgroup\$ – insertusernamehere Apr 25 '16 at 21:55
  • \$\begingroup\$ @insertusernamehere If your language does not have any way to support huge integers up to 2^64, the upper limit of that particular language must be supported instead \$\endgroup\$ – Martin Barker Apr 26 '16 at 1:05
  • 1
    \$\begingroup\$ If you increment inside the for, then you can spare 1 character by replacing string concatenation with variable embedding. I think another character can be spared by replacing != with < (though not sure, not read the entire requirement). for(;$i++<$argv[1];)echo"$i "; \$\endgroup\$ – manatwork Apr 26 '16 at 7:22

Julia, 11 bytes


This is an anonymous function that accepts an integer and returns an array from 1 to the input. This can handle large inputs just fine, it just requires passing n as a larger type, e.g. Int128 or BigInt.

  • \$\begingroup\$ You may be able to implement support for large integers without providing a different type (although there is no such thing in the rules, it's still a creative idea). \$\endgroup\$ – Erik the Outgolfer Apr 29 '16 at 17:34

Go, 90 bytes

Naive solution:

package main
import ."fmt"
func main(){var n,b uint64
  • \$\begingroup\$ Can this count up to 2^64? \$\endgroup\$ – Distjubo Apr 25 '16 at 14:50
  • \$\begingroup\$ @Distjubo Only to 2^32-1 if I'm not horribly mistaken. Ought to be unsigned. \$\endgroup\$ – seequ Apr 25 '16 at 20:27
  • \$\begingroup\$ @Distjubo It's okay though (2^64-1, I've changed the limit 'cause standard loopholes) \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 8:12
  • \$\begingroup\$ @Distjubo changed it to uint so I can get to 2^64-1 \$\endgroup\$ – Kristoffer Sall-Storgaard Apr 26 '16 at 8:16
  • \$\begingroup\$ Btw a signed 64-bit int has a max value of 2^63-1 and not 2^32-1 \$\endgroup\$ – Distjubo Apr 26 '16 at 12:18

Perl 6, 5 bytes


Sadly, 1..* is an infinite range, so I've got to cheat to make Perl 6 understand it's actually an anonymous function (and * is the placeholder).


Perl 5, 15 bytes + 8

Works with the -l and -Mbigint switch, and should work up to 2^64 with BigInt. Thanks to @andlrc for the 7 bytes shaved off.

print for 1..<>
  • \$\begingroup\$ You should use BigInt then. \$\endgroup\$ – Erik the Outgolfer Apr 25 '16 at 13:45
  • \$\begingroup\$ But you can do arbitary precision, thus you can count to pretty much infinite (2^65536 at least) \$\endgroup\$ – Bálint Apr 25 '16 at 14:52
  • 1
    \$\begingroup\$ You can use print for 1..<> \$\endgroup\$ – andlrc Apr 25 '16 at 15:33
  • \$\begingroup\$ @andlrc Thanks ! \$\endgroup\$ – Paul Picard Apr 26 '16 at 6:49
  • \$\begingroup\$ @ΈρικΚωνσταντόπουλος Edited to match this. \$\endgroup\$ – Paul Picard Apr 26 '16 at 6:49


I wasn't the first to post an answer in AHK, but mine are shorter for now. AutoHotKey doesn't like golf so the golfed versions are the same as the ungolfed versions. As for AutoHotKey's integer support:

For integers, 64-bit signed values are supported, which range from -9223372036854775808 (-0x8000000000000000) to 9223372036854775807 (0x7FFFFFFFFFFFFFFF). Any integer constants outside this range are not supported and might yield inconsistent results. By contrast, arithmetic operations on integers wrap around upon overflow (e.g. 0x7FFFFFFFFFFFFFFF + 1 = -0x8000000000000000).

Really Annoying Version - 25 bytes

Prints each number in a message box (super annoying) and takes input as the first argument on the command line.

Loop %1%
MsgBox % i++

i=1 - Loop counter set at 1
Loop %1% - Loop as many times as specified on the CLI
MsgBox % i++ = Display a message box with the digit in it, then increment

Alternate, Less Annoying Version - 43 bytes

This version displays only one message box but is much longer.

Loop %1%
j:=j . i++ . " "
MsgBox %j%

i=1 - Loop counter set at 1
j= - Variable j set to an empty string
Loop %1% - Loop as many times as specified on the CLI
j:=j . i++ . " " - concatenate i and a space to j, then increment i
MsgBox %j% = Display a message box with j in it

  • \$\begingroup\$ I hope there's a way to escape the loop! Counting just to 30 would be incredibly annoying. \$\endgroup\$ – Stewie Griffin Apr 26 '16 at 6:14
  • \$\begingroup\$ @StewieGriffin I mean, you can kill the process... But otherwise, no. \$\endgroup\$ – Nakaan Apr 26 '16 at 11:46
  • \$\begingroup\$ I think in the maximum signed int64 value you have 2 extra Fs. \$\endgroup\$ – Erik the Outgolfer May 2 '16 at 12:45
  • \$\begingroup\$ Here's a 26 byte less annoying version using Send as the output method (using \n to indicate a new line in the program because I need to use the accent/backtick in the program that messes with SE): Loop,%1%{ \n i++ \n Send,` %i% \n } \$\endgroup\$ – Engineer Toast Mar 28 '17 at 12:45

Jolf, 29 + 1 = 30 bytes

This in fact is valid! It uses the same technique as the JavaScript answer, keeping an array of digits. It should thus theoretically work, but may not work due to time limitations (browser crashing, etc.) Make sure to have "Pretty Output" enabled if it isn't already. (Apparently, making sure is an extra byte, like a flag, so there's that.) Try it here!



Z ~: 1
W < n i )
  a R ζ E
  Ζ ZW
    w lζ
    h .ζ w lζ
  on h n

That's real clean-looking for a golfing language! :D

  • \$\begingroup\$ What encoding is this? \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 18:16
  • \$\begingroup\$ You should add 1 byte because I must choose pretty output on. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 18:17
  • \$\begingroup\$ @ΈρικΚωνσταντόπουλος You are right on the latter. Also, it's encoded in ISO-8859-7. You can upload a file on the website. (It's the encoding that bears your name in 1-byte characters ;)) \$\endgroup\$ – Conor O'Brien Apr 26 '16 at 18:22
  • \$\begingroup\$ That's right. 2 more to go... \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 18:41
  • \$\begingroup\$ I don't think the encoding has to do something with here, as my name uses Unicode I think. \$\endgroup\$ – Erik the Outgolfer Apr 29 '16 at 17:40

C, 61 bytes

long i,n;main(){for(scanf("%ld",&n);i++<n;printf("%ld ",i));}

Essentially the same as my C++ answer, but C (or gcc) is more lenient of missing #includes, a missing return-type for main, and missing return-statements.

  • \$\begingroup\$ I disagree. Not all compilers support missing #includes. So you should add 18 bytes. \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 12:35
  • \$\begingroup\$ gcc is considered sort of a golden standard as far as C compilers are concerned. Since default gcc has always supported missing #include <stdio.h>, and corner-cutting is in general encouraged in code-golf, I still think this is legit. @Dennis seems to agree in a comment to this question. \$\endgroup\$ – tucuxi Apr 27 '16 at 13:07
  • \$\begingroup\$ You mean this comment? \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 13:18
  • \$\begingroup\$ Yes - and thanks to you, I now know how to link comments :-) \$\endgroup\$ – tucuxi Apr 27 '16 at 16:17
  • \$\begingroup\$ Remember, you always learn, no matter your age. The date of the comment is it's link (click on it to be linked to that particular comment). \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 17:29

Oracle SQL 11.2, 44 bytes

  • \$\begingroup\$ Nice to see an answer in SQL derivatives! \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.