# Count up from 0 to 2017 without numbers in your source

This question was profoundly inspired by Joe Z's question.

But, with a twist...

So, now that it's almost 2017, it's time for a code question involving the number 2017.

Your task is to make a program that counts up from 0, printing each number until it reaches 2017. without using any of the characters 012345678 or 9 in your code; and without using any variables such as the date or time or a random number.

# Acceptable Output

The output of your code must follow the following format:

[number]
[number]
[number]
etc.

A number, then a line feed, then repeat.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

# Example Output:

0
1
2
3
4
...
2016
2017

• Questions should be self-contained. You need to specify these in your own post, should the old question be unavailable in the future. Dec 12, 2016 at 21:58
• Don't be tricked the printing 2014 challenge having masses of votes. By modern standards, it's pretty awful, and I'd expect it to get a poor reception if posted today. See Using old challenges as a model as a thing to avoid, as well as Do X without Y.
– xnor
Dec 12, 2016 at 22:21
• ^ Agreed. Come up with your own unique challenge. Dec 12, 2016 at 22:32
• Too bad this was closed. I just came up with a 7 char/8 byte solution.
– Adám
Dec 13, 2016 at 10:49
• By the way, you also posted this (and suggested an edit to my 2014 question) about 19 days too early. The New Year's Puzzle is supposed to be posted exactly on the new year, wherever it happens to be where you live. Dec 13, 2016 at 16:40

## PowerShell v2+, 15 bytes

''..+[char]'ߡ'


UTF-8 code point 2017, ߡ, functions as our upper bound. We turn it from a string into a char with [''], then to an int with +. The lower bound '' is implicitly cast to 0. Thus, this is the range operator .. from 0 to 2017. Default Write-Output prints each number with newlines between.

• What a beautifully golfed answer! Dec 12, 2016 at 22:04

# Jelly, 6 bytes

“¬×’ḶY


Try it online!

Explanation:

“¬×’ḶY Main link. Arguments: 0
“¬×’              2018
Ḷ             Range [0..z)
Y            Join z by newlines


## Java, 99 bytes

Hobbyist programmer here. This is my first golf so apologies if I mess things up. Of course since I wrote in Java my code is going to be very large, but I think this may be as far as Java can go.

Golfed:

interface D{static void main(String[]z){for(int i='a'-'a';i<'ÿ'*''+'é';)System.out.println(i++);}


Ungolfed:

interface D{
static void main(String[]z){
for(int i='a'-'a';i<'ÿ'*''+'é';) //Between the seemingly empty quotes is an enquiry character with an ASCII value of 7, which has been included in the byte count and post.
System.out.println(i++);
}
}


Explanation: This solution abuses the interaction Java's compiler has with chars. Since Java interprets ASCII characters as bytes, I can use that fact to do arithmetic without actually ever using a number. The y with a diaeresis ASCII 255, enquiry is 7, and the acute e is 233 (so I can have 2017 be included). Hopefully this isn't too cheaty to do!

• Welcome to ppcg! Nice first post! Dec 22, 2016 at 3:51
• @Easterly Irk Cheers :) Hope I didn't do too poorly! Is there anything I need to know going further into golfing? Dec 22, 2016 at 4:26
• As you noted, Java isn't always the best language to golf in, but that's okay. Also, as you might have seen, many users on this site create their own languages to golf in. The consensus on that is as long as the language predates the challenge, that's fine. That's about it, hope you have fun and stay here with us! Dec 22, 2016 at 16:50

# APL (Dyalog APL), 13 bytes

Requires ⎕IO←0 which is default on many systems.

⍳⎕UCS'ߢ'


TryAPL online!

⍳ N first indices, where N is

⎕UCS the Unicode code point of

'ߢ' this character

• Oops, I misread Dec 12, 2016 at 22:16

# 05AB1E, 8 bytes

žCžw<-Ý»


Try it online!

# Labyrinth, 4943 40 bytes

))::+:#:*:
@        (
(\"))****(
{ }
)!:


Try it online!

# 7, 29 bytes, 78 characters

Not going to win, but I had fun writing it. 7 uses a 3-bit character set that packs 8 characters into 3 bytes. Here's the program in octal encoding (which is most natural for the language):

770267133177162277266362217240522405240540562240540554240524052405052405405513


and here's how it looks on disk (via an xxd dump); looking on the right, we can verify that the file contains no digits:

00000000: fc2d cb67 f392 fd6c f247 a82a 5055 0582  .-.g...l.G.*PU..
00000010: e4a0 b05b 1415 4154 1455 0582 d2         ...[..AT.U...


Try it online!

Underload is the brainfuck of stack-based languages, and 7 is a variant of Underload modified to provide I/O capabilities and to reduce the size of the command set. (The command set had to be modified to allow for things like outputting mismatched parentheses.) So this is an example of how to write this program in a very primitive and low-level language.

Here's how the program works:

77026


We start by pushing the stack element 02, escaped once (thus it'll still appear as 02 on the stack; normally there's one level of unescaping). To push a stack element in 7, you precede it with a 7, and enclose any parts you want to escape in 76.

7 133  17 716 22 77266 36
( ( )    (( ))  )


The rest of the program is all stored in one large stack element. (In 7, there's no way to write code that runs immediately; you have to start by pushing it as a literal to the stack, then rely on it getting appended to the program implicitly when the program runs out of space.) We start by discarding the large stack element in question (13), then outputting the element below (3); that's 02. The first output of the program sets the output format the program uses. In this case, we're using output format 0, "integers". That accounts for (and removes) the zero. The output format we're using works by counting the number of 7s and 1s in the output string, and subtracting the number of 6s and 0s, to produce the integer to output; in this case, the string 2 has no 0s, 1s, 6s, or 7s, so it outputs 0. Finally, a trailing 2 (in this output format) produces a newline (the output would "naturally" be space-separated). After that, we push a large literal to the stack. This will eventually be used as a loop body, so we'll consider it when it runs.

22 1724052240524054056 2240540554240524052405052405405


Some people here may be used to Underload numerals from a previous challenge. 7 numerals are fairly similar. In the linked challenge, the only characters used were : and *; numbers represented like that can translate into 7 directly, with 2 serving the role of : and 405 serving the role of * (note that it's actually equivalent to Underload's ~*, but the two act identically in this context). Thus, given a number n, you can add 1 to it using 2n405, and you can multiply two numbers by appending them to each other; the null string is 1. One thing the linked challenge didn't mention, though, is exponentiation. This works a little differently in 7 than in Underload, but the same basic principles are in use in each case. Additionally, in 7, you can handle addition via putting code between the 4 and 05 (something that's more verbose in Underload because you can't put code inside the *). So we can restructure this part of the program like this:

2
2
17         start a new number (=1)
2405     ×2                 (=2)
2        ×(1          (=1)
2405     ×2        (=2)
2405     ×2        (=4)
405       +1          (=5)) (=10)
6         end of the new number
2         ×(1          (=1)
2405      ×2        (=2)
405        +1          (=3)) (=3)
5          exponentiate (10 ^ 3 = 1000)
4           +(1          (=1)
2405         ×2        (=2)
2405         ×2        (=4)
2405         ×2        (=8)
05           )                 (=1008)
2405        ×2                 (=2016)
405            +1                 (=2017)


The rest of the program is:

5 13


The 5 starts a loop, running the stack literal we pushed earlier 2017 times. Finally, the 13 pops the top stack element, meaning that the stack is now empty and the program ends.

So what does the loop body do? Here's how it decodes:

716      Append a 1 to TOS
22       Make two more copies of the TOS
77266    Append a 2 to TOS
3        Output TOS, discard top two stack elements


Appending a 1 will increase the numerical value (initially zero) that numeric output will see the stack as having. We make two temporary copies, and append a 2 (to provide the newline required by the question). Then we output it, discarding the temporary copies in the process. Doing this 2017 times will thus count from 1 to 2017. We outputted the 0 earlier, thus completing the program.

• without numbers in your source Dec 14, 2016 at 11:25
• @RomanGräf: .-.g...l.G.*PU....[..AT.U... doesn't seem to contain numbers to me. (Non-ASCII and unprintable characters have been replaced with . there, but aren't digits by definition; all the digits are in ASCII.) The commands are all named after digits (when they have names at all), but none of them appear literally in the source itself.
– user62131
Dec 14, 2016 at 14:03
• Oh, I only read the octal translation. Dec 15, 2016 at 10:55

# ><> (Fish) 19 bytes

iaa,+:n:"#:"*d-=?;ao!


very simple, uses ascii chars to generate the number 2017 then compares to an increasing counter that gets printed.

i is input but without one becomes -1 a = 10 so aa, is 1 (10 div 10) "#:" becomes (# multiply :) which makes 2030 which we take 13 (d) from to make 2017 (This number is a prime so we can't save bytes here).

## Java, 147 bytes

Call with no cmd args

class t{public static void main(String[]a){int i=a.length,j=++i,h;j+=i--;h=j*j*j*j*j;j=h*j*j*j*j*j*j-(--h);j++;for(;i<j;)System.out.println(i++);}}


# MATL, 15 11 bytes

4 bytes saved thanks to @Luis

'? 'pQQ:q"@


Try it Online!

• @LuisMendo You're absolutely right! My golf skills are apparently getting rusty Dec 14, 2016 at 14:26
• You need more practice :-P Dec 14, 2016 at 17:26

## Python 3, 32 bytes

print(*range(ord('ߢ')),sep='\n')


## (K+R)eg, 9 bytes

ߡï(.\
,


Explanation:

ߡ      # Push 2017
ï     # Count all the way from 0
# Due to the irritating output-without-newline:
(    # Repeat the length of the stack times:
.   # Output the top of the stack
\ ,# Output 1 newline


TIO

## JavaScript (ES6), 52 bytes

for(n=x=+[],i=++x+x+''+n;n<i+i-x-x;)console.log(n++)


There's not much to say about it:

for(
n = x = +[],              // n = x = 0
i = ++x + x + '' + n;     // i = 1 + 1 + '' + 0 = "20"
n < i + i - x - x;        // n < "2020" - 1 - 1 <=> n < 2018
)
console.log(n++)

• It's acceptable for javascript answers to use alert() instead of console.log() which would save you a few bytes. Dec 13, 2016 at 23:11

# Stax, 6 bytes

ÇîHtUá


Run and debug it

Use packing to avoid appearance of the digits.

# Japt-R, 5 4 bytes

#ߢo


Test it

## Wnd, 7 bytes

♦kb-╖úÜ


## Explanation

Uncompressed:

2018   M % Foreach in the range 1..2018:
a1-  % Return the current item - 1

Flags:n  % Join the output with newlines
$$$$
`