30
\$\begingroup\$

Introduction

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.

Challenge

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

Rules

  • 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.

Bonuses

20%

  • 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.

\$\endgroup\$
  • 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

1
\$\begingroup\$

C++, 92 81 bytes

#include<cstdio> 
long i,n;int main(){for(scanf("%ld",&n);i++<n;printf("%ld ",i));}

And another version, using iostream, with the same byte count

#include<iostream>
long i,n;int main(){for(std::cin>>n;i++<n;std::cout<<i<<' ');}

Not using long would result in 32-bit integers in most platforms<; also, C++'s iostream library with their std:: namespace are more verbose than C's I/O. (edit - I stand corrected, this is not true)

Update (-9 bytes): Learnt that return was optional in C++ thanks to @anatolyg

\$\endgroup\$
  • \$\begingroup\$ Actually, I get exactly the same character count with cstdio as with iostream. Also, C++ doesn't require return 0. \$\endgroup\$ – anatolyg Apr 27 '16 at 14:46
  • \$\begingroup\$ Thanks for the tip regarding return; also adding an iostream version, as you are again right - same byte count. \$\endgroup\$ – tucuxi Apr 27 '16 at 16:23
1
\$\begingroup\$

Common Lisp, 39 bytes

Disclaimer: I'm not responsible for any traumatic effect caused by the extreme density of parentheses. It's the language specification's fault. This one has surprisingly few parentheses!

(loop for a from 1 to(read)do(write a))
\$\endgroup\$
1
\$\begingroup\$

Brachylog, 7 bytes

:1:efrw

or alternatively

:1:efr.
\$\endgroup\$
1
\$\begingroup\$

Python 3, 43 42 bytes

x,i=int(input()),0
while i<x:i+=1;print(i)

Explained line-by-line:

x,i=int(input()),0
x  =int(input())   # Convert string input to integer, then assign x to it
 ,              ,  # Separate variables
  i=             0 # Assign i to 0
while i<x:i+=1;print(i)
while    :              # Enter a WHILE loop
      i<x               # Set limit
          i+=1          # Count up
              ;         # Separate statements
               print(i) # Print number

Old answer below. Hopefully this one will be able to count up to incl. 2**64-1.


Python 3, 41 bytes

for n in range(1,int(input())+1):print(n)

Ungolfed

for number in range(1, int(input()) + 1):
    print(number)

Explained for those who can't understand

for n in range(1,int(input())+1):print(n)  # Code
for n in                        :          # Initiate a for loop with n as the number
         range( ,              )           # The list of numbers we want to output in order
               1                           # We start with 1
                     input()               # We get n from string input
                 int(       )              # We convert the input to integer
                             +1            # We add one to the range 'cause we want to include n
                                print( )   # We then output
                                      n    # n is what we output
\$\endgroup\$
  • \$\begingroup\$ This won't work for all 64-bit integers, so it is invalid by your own rules. \$\endgroup\$ – Dennis Apr 26 '16 at 18:07
  • \$\begingroup\$ I think it works (language limit). If there is a way to make it work up to 2^64-1, please tell me. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 18:38
  • \$\begingroup\$ You can use xrange(). Note: even xrange() may have issues, at least in 2.7.10. \$\endgroup\$ – user48538 Apr 26 '16 at 19:06
  • \$\begingroup\$ I used it in my (sadly, shorter) Python 2 answer. \$\endgroup\$ – user48538 Apr 26 '16 at 19:07
  • 1
    \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ as you only use your input once, you can just do while i<int(input)) . Also in your older version at 41 bytes, by removing the 1, in you range and the add 1 after the input, and placing either +1 after or -~ before the n in the print, it will be shorter and get the same answer. Also can I ask why your older answer is shorter, but you're not using it? \$\endgroup\$ – george Jun 15 '16 at 17:45
1
\$\begingroup\$

Turing Machine Simulator - 1366 Bytes (124 Lines)

0 * * r 0
0 _ , r 1
1 _ 1 r ,
, _ , l 2
2 * * l 2
2 , * l 3
3 _ * r 4
3 1 0 l 4
3 2 1 l 4
3 3 2 l 4
3 4 3 l 4
3 5 4 l 4
3 6 5 l 4
3 7 6 l 4
3 8 7 l 4
3 9 8 l 4
3 0 9 l 3
4 * * l 4
4 _ * r 5
5 0 _ r 5
5 , * * n
5 * * r 6
6 * * r 6
6 , * r 9
9 * * r 9
9 _ * l z
z * * l m
m * * l m
m , * r 7
7 * * r 7
7 , * * x
7 0 p r p
7 1 q r q
7 2 w r w
7 3 e r e
7 4 r r r
7 5 t r t
7 6 y r y
7 7 u r u
7 8 i r i
7 9 o r o
8 * * l 8
8 , * l m
p * * r p
p . * r P
p _ . r P
P * * r P
P _ 0 l 8
q * * r q
q . * r Q
q _ . r Q
Q * * r Q
Q _ 1 l 8
w * * r w
w . * r W
w _ . r W
W * * r W
W _ 2 l 8
e * * r e
e . * r E
e _ . r E
E * * r E
E _ 3 l 8
r * * r r
r . * r R
r _ . r R
R * * r R
R _ 4 l 8
t * * r t
t . * r T
t _ . r T
T * * r T
T _ 5 l 8
y * * r y
y . * r Y
y _ . r Y
Y * * r Y
Y _ 6 l 8
u * * r u
u . * r U
u _ . r U
U * * r U
U _ 7 l 8
i * * r i
i . * r I
i _ . r I
I * * r I
I _ 8 l 8
o * * r o
o . * r O
o _ . r O
O * * r O
O _ 9 l 8
x * * r x
x _ , l b
b . 1 l c
b 0 1 l c
b 1 2 l c
b 2 3 l c 
b 3 4 l c
b 4 5 l c
b 5 6 l c
b 6 7 l c
b 7 8 l c
b 8 9 l c
b 9 0 l b
c * * l c
c _ * r v
v * * r v
v , * * 2
n * * r n
n _ * r halt
n , _ r n
n . _ r n
n p 0 r n
n q 1 r n
n w 2 r n
n e 3 r n
n r 4 r n
n t 5 r n
n y 6 r n
n u 7 r n
n i 8 r n
n o 9 r n

You can try it out here - link Just set the initial input to the upper limit.

Supports arbitrarily large integers

\$\endgroup\$
  • \$\begingroup\$ Where is the spec for this language? \$\endgroup\$ – Erik the Outgolfer Jul 19 '16 at 17:05
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ It should be a the bottom of the page in the link \$\endgroup\$ – KoreanwGlasses Jul 19 '16 at 17:06
  • \$\begingroup\$ Not the syntax, the states, what they mean, etc. \$\endgroup\$ – Erik the Outgolfer Jul 19 '16 at 17:08
  • \$\begingroup\$ @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Is this what you're looking for? en.wikipedia.org/wiki/Turing_machine#Informal_description \$\endgroup\$ – KoreanwGlasses Jul 19 '16 at 17:16
  • \$\begingroup\$ No, i wouldn't have asked if it was there. I don't mean the syntax, or how the states work, I mean what the states are. \$\endgroup\$ – Erik the Outgolfer Jul 19 '16 at 18:09
1
\$\begingroup\$

UGL, 14 11 bytes

ic^l_u$ocO^^-:
il$d:_locO:

Uses U+0000 as delimiter.

Try it online!

Try it online! (14-byte version)

Explanation

This builds [9,8,7,6,5,4,3,2,1] for an input of 9, and then print them all out (with U+0000 as separator).

Explanation for 14 bytes

ic^l_u$ocO^^-:
i               # n = input()
 c              # i = 0
  ^l_     ^^-:  # while i ~= n:
     u$o        #     print(i++)
        cO      #     print(chr(0))
\$\endgroup\$
1
\$\begingroup\$

PHP, 26 23 31 bytes

<?=join(' ',range(1,$argv[1])); // 31 if using N isnt allowed     
<?=join(' ',range(1,$n)); // 25 if using $n is allowed
<?=join(' ',range(1,N)); // 24 bytes, join() is an alias of implode()
<?=implode(' ',range(1,N)); // 27 bytes

"You can get n any way" -> In this case, N is a constant.
Edit: Apperantly "any way" isn't "any way", it now takes commandline arguments

\$\endgroup\$
  • 1
    \$\begingroup\$ Hardcoding inputs is not allowed by default, and the author does not override that default (as you can see from this comment). \$\endgroup\$ – Mego Apr 26 '16 at 9:33
  • \$\begingroup\$ Updated accordingly \$\endgroup\$ – Martijn Apr 26 '16 at 9:55
  • \$\begingroup\$ @Mego You are correct, I clearly state you must get n. I didn't do any override. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 10:48
  • \$\begingroup\$ Which I interpretted as "I get N from a constant" ;) But, changed my answer to the proper interpretation \$\endgroup\$ – Martijn Apr 26 '16 at 12:30
  • \$\begingroup\$ Isn't the statement-ending semicolon required? Omitting it on an online PHP codepad gives Fatal error: syntax error, unexpected $end, expecting ',' or ';' \$\endgroup\$ – nickb Apr 27 '16 at 4:05
1
\$\begingroup\$

Python 3, 31 bytes

print(*range(1,int(input())+1))

Outputs the range of numbers space-separated. Uses * operator magic to explode the output of range into separate arguments to print, which separates its arguments with spaces by default.

\$\endgroup\$
1
\$\begingroup\$

Dip, 1 - .2 = .8

l

Body must be at least 30 characters; you entered 13.

\$\endgroup\$
  • \$\begingroup\$ Can you provide a link to a Dip interpreter? I can´t find any reference to that language on the web. \$\endgroup\$ – Titus Jul 7 '17 at 15:20
  • \$\begingroup\$ It was my language but i deleted it \$\endgroup\$ – Oliver Ni Jul 8 '17 at 16:24
1
\$\begingroup\$

C#, 105 117 109 107 101 99 59 bytes


Golfed

void m(ulong u){while(u>=0)System.Console.WriteLine(u--);}

Ungolfed

void m( ulong u ) {
    while (u >= 0)
        System.Console.WriteLine(u--);
}

Releases

  • v3.0 - -40 bytes - Changed the output to directly print to the console with a new line at the end. This update allows the usage of ulong. Once again, this is thanks to hstde.
  • v2.4 - -2 bytes - Replaced long with int due to the limitations of the capacity of List<T>, which is capped to the max of Int32.MaxValue in the implementation. The reason for changing to int can be found here. You can also explore this limitation in Reference Source.
  • v2.3 - -6 bytes - Using var instead of List<long>. Thanks to hstde.
  • v2.2 - -2 bytes - Fixed the decrements of the counter and removed brackets.
  • v2.1 - -8 bytes - Update to use the argument, making the code shorter and faster.
  • v2.0 - +12 bytes - Update to List<> since arrays max size is Int32.MaxValue == 2 ^ 32 - 1
  • v1.0 - 105 bytes - Initial release
\$\endgroup\$
  • \$\begingroup\$ You're still gonna have a problem with anything bigger than int.MaxValue. But you can still shave off some bytes by replacing List<long>l with var l \$\endgroup\$ – hstde Nov 8 '16 at 10:46
  • \$\begingroup\$ @hstde Unfortunately, as far as I know, the Array and List object in the .Net have a limitation of Int32.MaxValue ( 2 147 483 647 ) items. Although I haven't explore this fully, for what I've read you would most likely ran out of memory than hit the limitation of the objects. Please, correct me if I'm wrong. \$\endgroup\$ – auhmaan Nov 9 '16 at 14:41
  • \$\begingroup\$ I played around a little and you indeed get an out of memory exception even when using something other then List<>. So the correct implementation would be an iterative from 0 to c. \$\endgroup\$ – hstde Nov 9 '16 at 14:57
  • \$\begingroup\$ Even if I was able to implement a way to count up to the Int64.MaxValue - which is required by the challenge - I would hit the size limit of the String, which is Int32.MaxValue. \$\endgroup\$ – auhmaan Nov 9 '16 at 15:14
  • 1
    \$\begingroup\$ You are right. That's why I need to learn to read... \$\endgroup\$ – auhmaan Nov 10 '16 at 17:47
1
\$\begingroup\$

Labyrinth, 41 29 23 14 bytes

?}):
 \ !
@"({

Try it online!

Takes the input number and moves it to the auxiliary stack and increments an implicit zero on the main stack. Repeatedly duplicates the top of the stack, outputs the number, moves a copy of the input number from the aux stack and decrements it. If that number is zero, the program exits. Otherwise it outputs a newline and continues the loop.

\$\endgroup\$
1
\$\begingroup\$

LibreLogo, 35 bytes

Code:

print set range 1 (int (input ")+1)

Input:

enter image description here

Output:

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Taxi, 1,264 bytes

Line breaks are not required so here's the golfed version:

Go to Post Office: w 1 l, 1 r, 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery: s 1 l, 1 r.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park: n 1 l, 1 l, 1 r.[a]1 is waiting at Starchild Numerology.Go to Starchild Numerology: s 3 l.Pickup a passenger going to Addition Alley.Go to Go More: e 1 l.Go to Addition Alley: w 1 r, 3 r, 1 r.Pickup a passenger going to Cyclone.Go to Cyclone: n 1 l, 1 l.Pickup a passenger going to Cyclone.Pickup a passenger going to The Babelfishery.Go to The Babelfishery: s 1 l, 2 r, 1 r.Pickup a passenger going to Post Office." " is waiting at Writer's Depot.Go to Writer's Depot: n 1 l, 1 l, 2 l.Pickup a passenger going to Post Office.Go to Post Office: n 1 r, 2 r, 1 l.Go to Cyclone: s 1 r, 1 l, 2 r.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Equal's Corner.Go to Sunny Skies Park: n 1 r.Pickup a passenger going to Cyclone.Go to Cyclone: n 1 l.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Equal's Corner.Go to Sunny Skies Park: n 1 r.Pickup a passenger going to Addition Alley.Go to Equal's Corner: s.Switch to plan "b" if no one is waiting.Go to Taxi Garage: n 3 r, 1 r, 2 l, 2 r.[b]Go to Sunny Skies Park: n.Switch to plan "a".

And the formatted version for humans:

Go to Post Office: w 1 l, 1 r, 1 l.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: s 1 l, 1 r.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park: n 1 l, 1 l, 1 r.
[a]
1 is waiting at Starchild Numerology.
Go to Starchild Numerology: s 3 l.
Pickup a passenger going to Addition Alley.
Go to Go More: e 1 l.
Go to Addition Alley: w 1 r, 3 r, 1 r.
Pickup a passenger going to Cyclone.
Go to Cyclone: n 1 l, 1 l.
Pickup a passenger going to Cyclone.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: s 1 l, 2 r, 1 r.
Pickup a passenger going to Post Office.
" " is waiting at Writer's Depot.
Go to Writer's Depot: n 1 l, 1 l, 2 l.
Pickup a passenger going to Post Office.
Go to Post Office: n 1 r, 2 r, 1 l.
Go to Cyclone: s 1 r, 1 l, 2 r.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Equal's Corner.
Go to Sunny Skies Park: n 1 r.
Pickup a passenger going to Cyclone.
Go to Cyclone: n 1 l.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Equal's Corner.
Go to Sunny Skies Park: n 1 r.
Pickup a passenger going to Addition Alley.
Go to Equal's Corner: s.
Switch to plan "b" if no one is waiting.
Go to Taxi Garage: n 3 r, 1 r, 2 l, 2 r.
[b]
Go to Sunny Skies Park: n.
Switch to plan "a".

I can't find any documentation on integer limits, but my testing seems to show that Taxi can handle up to 64 bit signed integers but not un-signed. That means it can only count up to (2^63)-1.

\$\endgroup\$
1
\$\begingroup\$

QBIC - non-competing, 6 bytes

:[a|?b

Start a FOR-loop ranging from 1 (default start of FOR-loops) to a, where a is read by : from the command line parameters. At every iteration, b (our FOR-loop counter) is printed (?).

\$\endgroup\$
1
\$\begingroup\$

Stax, 1 byte

m

Run and debug online!

Added for completeness. That's it. Stax does it in 1 byte.

\$\endgroup\$
0
\$\begingroup\$

C++, 91 bytes

Golfed:

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

Ungolfed:

#include<iostream>
int main(){
    int c;
    std::cin>>c;
    for(int x = 1; x <= c; x++){
        std::cout<<x<<"\n";
    }
}
\$\endgroup\$
  • \$\begingroup\$ No C++ expert, but I think that int must return something. \$\endgroup\$ – Erik the Outgolfer Apr 25 '16 at 16:49
  • \$\begingroup\$ Actually, no. The 'return 0' is implied by almost all modern compilers. \$\endgroup\$ – Michelfrancis Bustillos Apr 25 '16 at 17:04
  • \$\begingroup\$ does std::cin>>c work i though it would cause type cast error char* to int... \$\endgroup\$ – Martin Barker Apr 26 '16 at 1:11
  • \$\begingroup\$ @MartinBarker That error only occurs if the user inputs something other than an int. \$\endgroup\$ – Michelfrancis Bustillos Apr 26 '16 at 3:13
  • 1
    \$\begingroup\$ You can declare x together with c to spare the second use of int, no need for the braces around a single instruction after for, you can increment x when outputting it so not need to mention it again inside for. At least g++ 5.2.1 accepts this (of course, after the include): int main(){int c,x;std::cin>>c;for(x=1;x<=c;)std::cout<<x++<<"\n";}. \$\endgroup\$ – manatwork Apr 26 '16 at 7:29
0
\$\begingroup\$

TI-Basic, 11 bytes

For(I,1,Ans:Disp I:End

I would do seq(I,I,1,Ans for 8 bytes but lists can't support 2^64 elements

\$\endgroup\$
  • \$\begingroup\$ Could you support 2^64-1 with seq(I,I,1,Ans? \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 8:17
  • \$\begingroup\$ @ΈρικΚωνσταντόπουλος Yes, as a single element, but the entire sequence would exceed the 999 element limit for a list, and exceed the calculator's memory. \$\endgroup\$ – Timtech Apr 26 '16 at 18:41
  • \$\begingroup\$ Then keep your 11-keystroke solution. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 18:42
0
\$\begingroup\$

Bash, 34 Bytes

for ((i=1;i<=$1;i++)); { echo $i;}

Split answer from GNU coreutils, this is pure bash.

\$\endgroup\$
  • 3
    \$\begingroup\$ for((;i++<$1;));{ echo $i;} - 27 bytes. But bash uses 64 bit signed integers, so this will only go as far as 2^31 - 1 \$\endgroup\$ – Digital Trauma Apr 25 '16 at 17:54
  • \$\begingroup\$ That's the limit for 32 bit integers, not 64. \$\endgroup\$ – CalculatorFeline Apr 26 '16 at 5:31
  • \$\begingroup\$ @DigitalTrauma 64-bit integers meet the spec (2^64-1), 32-bit ints don't. It's fine, though. \$\endgroup\$ – Erik the Outgolfer Apr 26 '16 at 8:19
  • 1
    \$\begingroup\$ The sign uses one of the 64 bits (not half of them!), so bash's maximum is 2^63-1 (empirically verified). \$\endgroup\$ – joeytwiddle Apr 26 '16 at 14:39
  • \$\begingroup\$ @CatsAreFluffy ha - of course I meant 2^63-1. 2^31 is an old force of habit I suppose. Still doesn't meet the spec IMO. \$\endgroup\$ – Digital Trauma Apr 26 '16 at 14:57
0
\$\begingroup\$

PGP, 28 Bytes

PHP Golf Processor (https://github.com/barkermn01/PGP-php-CodeGolf/) to run it php pgp.php file.pgp or php pgp.php '{code here}'

f(;$i!=$argv[1];)e ++$i." "; 
\$\endgroup\$
  • \$\begingroup\$ Can't you remove the space? e ++ \$\endgroup\$ – Erik the Outgolfer Apr 29 '16 at 17:49
  • \$\begingroup\$ Not yet, your welcome to code it it in and send me a pull request :) \$\endgroup\$ – Martin Barker Apr 30 '16 at 21:16
  • 1
    \$\begingroup\$ how about f(;$i++!=$argv[1];)e"$i ";? \$\endgroup\$ – Titus Jul 26 '16 at 1:38
0
\$\begingroup\$

Molecule, 10 bytes

0{1+~}InL.

Explanation:

0{1+~}InL.
0          Push 0
 {1+~}     Create a code block
      In   Ask the amount of times to repeat
        L. Loop the code block n times and clean the stack.
\$\endgroup\$
0
\$\begingroup\$

Ruby, 18 12 bytes

->n{p *1..n}

-3 bytes from Not that Charles, and -3 more from daniero

\$\endgroup\$
  • \$\begingroup\$ Can't you remove that space? \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 13:14
  • \$\begingroup\$ @ΈρικΚωνσταντόπουλος No. if i do it will try to multiply. \$\endgroup\$ – MegaTom Apr 27 '16 at 15:10
  • \$\begingroup\$ Oh 13 more to go... \$\endgroup\$ – Erik the Outgolfer Apr 27 '16 at 15:41
  • \$\begingroup\$ You can use p instead of puts \$\endgroup\$ – daniero Apr 29 '16 at 11:56
0
\$\begingroup\$

Scratch, 12 10 bytes

Script
(scoring used)
Asks for the end number, resets, and counts up.

\$\endgroup\$
  • \$\begingroup\$ Finally an answer! \$\endgroup\$ – Erik the Outgolfer May 20 '16 at 14:51
  • \$\begingroup\$ Scratch projects are meant to run multiple times. \$\endgroup\$ – weatherman115 May 20 '16 at 15:24
  • \$\begingroup\$ See my remix \$\endgroup\$ – Erik the Outgolfer May 20 '16 at 15:34
  • \$\begingroup\$ Well, you can golf it more: 1) Replace ask[\]]and wait with ask[]and wait for -1 point 2) To conform with the rules, you must say[] or say[]for()secs each and every number ("think" is considered STDERR for this challenge). So instead of add(c)to[list v use say(c 3) Since you do not need the list anymore you can remove the delete(all v)of[list v block for another -1 point. so you save a total of 2 points, resulting 10 points (both versions) \$\endgroup\$ – Erik the Outgolfer May 20 '16 at 15:37
  • \$\begingroup\$ scratchblocks \$\endgroup\$ – Erik the Outgolfer May 21 '16 at 13:14
0
\$\begingroup\$

Tellurium, 6 bytes

[I|+^]

This code runs a loop for an amount of times specified by the user (I). + adds one to the cell's value and ^ outputs the value.

\$\endgroup\$
0
\$\begingroup\$

Desmos, 60+table bytes

l=\left[1,2,...,\operatorname{floor}\left(a\right)\right]
a=0

Table
I have a set to 0 because the table would contain extra spaces if I didn't. That said, there isn't currently scoring for the table, which I've asked about on meta.

\$\endgroup\$
0
\$\begingroup\$

PyCal, 6 bytes

*i[+^]

This runs the code +^ for n times.

+ adds one to the variable and ^ outputs the variable's value. Simple enough.

EDIT: Interestingly enough, this solution is the exact same length as my Tellurium (another esoteric language I made) solution.

\$\endgroup\$
0
\$\begingroup\$

Python 2, 36 bytes

i=0
x=input()
while i<x:i+=1;print i

Explanation

Line 1

i=0 Generate the accumulator

Line 2

x=input() Store the number

Line 3

while Loop i<x while the accumulator is smaller than the number.

Line 3.1

i+=1 Increment the accumulator.

Line 3.2

print i Print the accumulator.

\$\endgroup\$
0
\$\begingroup\$

PureData, 462 bytes

As file:

#N canvas 778 126 591 616 10;
#X obj 136 137 until;
#X obj 175 177 f;
#X obj 258 160 + 1;
#X obj 352 194 + 1;
#X msg 215 126 0;
#X obj 393 211 log/normal;
#X obj 215 96 moses;
#X obj 215 66 - 1;
#X msg 136 49 1.84467e+019;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 0 3 0;
#X connect 2 0 1 1;
#X connect 3 0 5 0;
#X connect 3 0 6 1;
#X connect 4 0 1 1;
#X connect 6 0 4 0;
#X connect 6 0 0 1;
#X connect 7 0 6 0;
#X connect 8 0 0 0;
#X connect 8 0 7 0;

Actual program, because it's a graphical programming language:

enter image description here

Note: Do NOT run it with this value as it will run for a very long time!

\$\endgroup\$
  • \$\begingroup\$ moses? 18446744073709551615? Did you really have to impose that limit explicitly? \$\endgroup\$ – Erik the Outgolfer Jul 19 '16 at 19:23
  • \$\begingroup\$ moses will part the sea, in this case it works like an if statement, if the left inlet's value is less than the right inlet's value it will send a bang through it's left outlet. I couldn't find any standard input like object in it, so you have to write your input number into that message box and click on it so the program starts. \$\endgroup\$ – Gábor Fekete Jul 19 '16 at 19:28
  • \$\begingroup\$ Is this a joke language? moses will part the sea? Sounds religious to me... \$\endgroup\$ – Erik the Outgolfer Jul 19 '16 at 19:34
  • \$\begingroup\$ puredata or pd is a discontinued visual programming language mostly for processing and generating sound. moses distributes the input value through it's outputs. \$\endgroup\$ – Gábor Fekete Jul 19 '16 at 19:38
0
\$\begingroup\$

Emacs Lisp, 39 bytes

(lambda(n)(princ(number-sequence 1 n)))
\$\endgroup\$
0
\$\begingroup\$

Jellyfish, 5 bytes

p`>ri

Try it online!

Explanation

p     `    >         r     i
print(each_increment(range(input)))
\$\endgroup\$
0
\$\begingroup\$

C#, 47 bytes

l=>{for(int i=1;i<=l;)Console.WriteLine(i++);};
\$\endgroup\$

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.