169
\$\begingroup\$

Challenge:

Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on.

You can not reuse any characters between the programs. So, if the first program is: x==x, then you may not use the characters x and = again in any of the other programs. Note: It's allowed to use the same character many times in one program.

Scoring:

The winner will be the submission that counts the highest. In case there's a tie, the winner will be the submission that used the fewest number of bytes in total.

Rules:

  • You can only use a single language for all integers
  • Snippets are allowed!
  • To keep it fair, all characters must be encoded using a single byte in the language you choose.
  • The output must be in decimal. You may not output it with scientific notation or some other alternative format. Outputting floats is OK, as long as all digits that are shown behind the decimal point are 0. So, 4.000 is accepted. Inaccuracies due to FPA is accepted, as long as it's not shown in the output.
  • ans =, leading and trailing spaces and newlines etc. are allowed.
  • You may disregard STDERR, as long as the correct output is returned to STDOUT
  • You may choose to output the integer to STDERR, but only if STDOUT is empty.
  • Symbol independent languages (such as Lenguage) are disallowed
  • Letters are case sensitive a != A.
  • The programs must be independent
  • Whitespace can't be reused
  • You must use ASCII-digits in the output

Explanations are encouraged!

\$\endgroup\$
13
  • 4
    \$\begingroup\$ The language Headsecks only cares about the lower three bits of every character and would trivially achieve a score of 64. It's partially symbol-independent, but not completely. I think the last rule should cover partially symbol-independent languages as well, but I'm not sure how to phrase it. \$\endgroup\$
    – Dennis
    Commented Jun 4, 2017 at 22:45
  • 1
    \$\begingroup\$ Regarding the snippet rule, do we still need to include usings/imports? And are static imports allowed (without making them part of the snippet that is)? \$\endgroup\$ Commented Jun 6, 2017 at 17:45
  • 1
    \$\begingroup\$ @KevinCruijssen you can omit boilerplate stuff that's needed for every programs/functions. For instance, you don't need #include <iostream> and other boilerplate stuff in C++. You do need from numpy import *. Note: I'm not a programmer, so I don't know all the nuances. We can discuss in chat if something is unclear :) \$\endgroup\$ Commented Jun 6, 2017 at 18:05
  • 1
    \$\begingroup\$ You have the right to vote however you like @tuskiomi, but in my opinion it's a good rule. Whitespace characters are just bytes, just as any other character. Why should they be treated differently? Also, the language Whitespace would win by a landslide, since it contains only space, tab and line shift. Thanks for saying why you downvoted though :-) \$\endgroup\$ Commented Aug 18, 2017 at 17:31
  • 1
    \$\begingroup\$ @StewieGriffin I would at least allow spaces, but hey, I'm not you. \$\endgroup\$
    – tuskiomi
    Commented Aug 18, 2017 at 18:30

73 Answers 73

1 2
3
1
\$\begingroup\$

MAWP 2.0, score 12, 40 bytes

:                       Outputs the 1 on stack
2              ------|     
3                    |
4                    |
5                    |
6                     > Number literals
7                    |
8                    |
9                    |
10             ------| 
__________              Pushes length of stack 10 times, snippet for 11
!!++!+!+                Duplicates and adds 1 on stack, snippet for 12

The most basic I could come up with. Try it!

\$\endgroup\$
2
  • \$\begingroup\$ I think this is optimal, since you've used all the commands that can push things to the stack. The only other thought would be split up the 10 command and push 10 using 0 while moving 1 to 11. I am a little confused over the + command though, since that isn't mentioned in the documentation. Is that meant to replace M? \$\endgroup\$
    – Jo King
    Commented Oct 7, 2020 at 9:00
  • \$\begingroup\$ @JoKing MAWP has been replaced with +-*$ in 2.0, I've written documentation for it in esolangs but forgot to transfer it to the interpreter \$\endgroup\$
    – Dion
    Commented Oct 7, 2020 at 9:10
1
\$\begingroup\$

Pxem (lazypxem.min.posixism), score: 255.

I annotated who are not ASCII printables as octal, prefixed by a backslash. One snippet per line.

\001
\002
\003
\004
\005
\006
\007
\010
\011
\012
\013
\014
\015
\016
\017
\020
\021
\022
\023
\024
\025
\026
\027
\030
\031
\032
\033
\034
\035
\036
\037
 
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
\177
\200
\201
\202
\203
\204
\205
\206
\207
\210
\211
\212
\213
\214
\215
\216
\217
\220
\221
\222
\223
\224
\225
\226
\227
\230
\231
\232
\233
\234
\235
\236
\237
\240
\241
\242
\243
\244
\245
\246
\247
\250
\251
\252
\253
\254
\255
\256
\257
\260
\261
\262
\263
\264
\265
\266
\267
\270
\271
\272
\273
\274
\275
\276
\277
\300
\301
\302
\303
\304
\305
\306
\307
\310
\311
\312
\313
\314
\315
\316
\317
\320
\321
\322
\323
\324
\325
\326
\327
\330
\331
\332
\333
\334
\335
\336
\337
\340
\341
\342
\343
\344
\345
\346
\347
\350
\351
\352
\353
\354
\355
\356
\357
\360
\361
\362
\363
\364
\365
\366
\367
\370
\371
\372
\373
\374
\375
\376
\377

What they do

They are snippets. They just push their own codepoint to stack. Because my interpreter just treats each byte to be unit, any sequences of bytes can be snippets.

If you think my answer is not qualified as a function: make a content that consists of just one of those snippets, and call it with .f on filename; this is how my snippets work like functions.

Notes about snippets

  • A snippet / must be on content rather than on filename, as it's not for filename (although my interpreter just ignores the restriction).
  • A snippet . must not be followed by one of these characters: PpOoNnIi_CcSsVvFfEeRrWwXxYyZzAaTtMmDd+-!$%; as a substring of the two letters stands for a command; vise versa for latter characters.
\$\endgroup\$
1
\$\begingroup\$

Desmos, score 12 13, 80 bytes

\n\{\}
0!+0!
lneee
2^2
5
6
7
8
9
3*3.333333333333
11
4--4--4
count(a,a,a,a,a,a,a,a,a,a,a,a,a)

\n represents a newline, not the literal characters.

+1 score thanks to guest4308

\$\endgroup\$
7
  • \$\begingroup\$ if you use 0!+0! for 2 you can use count(a,a,a,a,a,a,a,a,a,a,a,a,a) for 13 (also the first one should be fine as just {}) \$\endgroup\$
    – guest4308
    Commented Mar 17 at 6:38
  • \$\begingroup\$ actualy if you use tau/pi for 2 then you can use 0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0! for 14 \$\endgroup\$
    – guest4308
    Commented Mar 17 at 6:46
  • \$\begingroup\$ @guest4308 The first one can't be just {} because then it would be invisible and return nothing. tau/pi would have to be changed to \tau/\pi which would reuse the \ from the first one. \$\endgroup\$
    – Yousername
    Commented Mar 17 at 14:22
  • \$\begingroup\$ maybe you're using a different desmos then I am? all that I'm aware of is the one hosted at desmos.com/calculator which seems to be the same one you link in the first line, and using backslashes seems to break it rather than make it work \$\endgroup\$
    – guest4308
    Commented Mar 19 at 13:25
  • 1
    \$\begingroup\$ @guest4308 Try pasting it in. \$\endgroup\$
    – Yousername
    Commented Mar 19 at 20:36
0
\$\begingroup\$

Perl REPL, score 16

Get Perl REPL by using perl -nE'say eval'.

__LINE__
2
3
4
5
6
length
8
9
cos,abs
11
0xC
$.
7+7
!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()+!rmdir()
//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//- -//

Other things I tried:

(ord Z)-(ord K)

And here are some ideas of how to cheat:

  • umask
  • tell
  • getppid
  • getpgrp
  • wait
  • system
  • time
  • srand
  • localtime
  • gmtime
  • ls|wc -l <---- cheating, has preconditions
\$\endgroup\$
4
  • \$\begingroup\$ There's a lot more that can be done here \$\endgroup\$ Commented Jun 5, 2017 at 15:32
  • 14
    \$\begingroup\$ + in both 14 and 15. \$\endgroup\$
    – Ole Tange
    Commented Jun 5, 2017 at 15:50
  • 3
    \$\begingroup\$ I feel that $. is cheating, as it would not work without the previous commands having run. I'd consider it acceptable in the first spot only. \$\endgroup\$ Commented Jun 5, 2017 at 17:27
  • \$\begingroup\$ There's a + in both your 14 and your 15. \$\endgroup\$ Commented Aug 21, 2017 at 11:57
0
\$\begingroup\$

Microscript II, score 13 (33 bytes)

e
2
3
4
5
6
7
8
9
EE
11
ssssssssssss#
"na"Ko-
\$\endgroup\$
0
\$\begingroup\$

Unreadable, score 1, 150 4 bytes

'"""

Try it online!

-146 bytes because snippets are allowed

Returns 1

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

Pain-Flak, Score 1

))((}{

Try it online!

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

Whitespace, score 1, 5 bytes

     

or perhaps more readable (where S are spaces, T are tabs, and N are newlines):

SSSTN

Try it online.

Explanation:

Whitespace only has three available characters: spaces, tabs, and newlines (with unicode values 32, 9, and 10 respectively), every other character is ignored. The snippet above will:

  • S: Enable Stack Manipulation
  • S...N: Push the number to the stack
  • S: A positive number (T would have been negative)
  • T: Some S and T as binary, where S is 0 and T is 1. So the T is both binary and decimal 1 in this case.

The footer of the TIO-link is TNST, which will:

  • TN: Enable I/O
  • NT: Print the top of the stack as number to STDOUT
\$\endgroup\$
0
\$\begingroup\$

ArnoldC, score 1, 57 bytes

I have a question with this. Would an "ArnoldC snippet" exist? Would it consist of removing IT'S SHOWTIME (beginMain) and YOU HAVE BEEN TERMINATED (endMain)? Would we need to I'LL BE BACK (return)? Anyway, if it doesn't, I can count to ... 1.

IT'S SHOWTIME
TALK TO THE HAND 1
YOU HAVE BEEN TERMINATED

Try it online!

\$\endgroup\$
2
  • 3
    \$\begingroup\$ A snippet removes the boilerplate stuff that's needed for every programs/functions. \$\endgroup\$
    – user85052
    Commented Sep 14, 2019 at 22:06
  • \$\begingroup\$ @A_ I should be studying the chars I used then :) Thanks for your comment on this answer (and on the mariolang one too). \$\endgroup\$ Commented Sep 25, 2019 at 8:30
0
\$\begingroup\$

1+ (TwilightSparkle Edition), score 3, 12 bytes

...Yeah, not the best idea since I only have 8 characters (tarpits gonna tarpit) to work with but let's see how much is possible. -- the BF answer

1+ suffers from its lack of literal, so I have to use my own version instead.

1
,,<"+
[###]#

Ok I admit TwilightSparkle Edition is an improved interpreter I made for 1+ (because the original interpreter is terrible. Prompt... no EOF... who knows what Parcly Taxel is thinking of)

1 pushes 1. This is the only literal in 1+.

EOF is 0 in TwilightSparkle Edition, so , pushes 0. < is the "less-than-or-equal" operator, the only comparison operator in 1+. So ,,< pushes 1. " duplicates the stack and + add two numbers so this pushes 2.

When a # errors out it prints out its ordinal for debugging reasons, so the last one prints 3 (numbering starts from 0). That prints 3.

I guess this is all we can do.

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

A0A0, 2 integers, 6 bytes

O1
P50

O1 prints the number 1, P50 prints the ascii character belonging to value 50, which is 2. These are the only two ways to print something in A0A0, so you won't get much further than this.

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

ArcPlus, score 1, 4 bytes

(p 1

Prints 1

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

Vyxal 3

1-9

Just 1, 2, ...

10

Builtin for 10.

11

₂½vv

26 halved then decremented twice.

12

₆√⌈

ceil(sqrt(128))

13

₇∑

2 + 5 + 6

14

Ŀ:::::::::::::`

log(0) is defined as 1, so we just duplicate a bunch of times and output the length of the stack.

15

"ᵒ“

15 compressed in base 252.

16

Builtin for 16.

17

ko⁻ΠṪκt

Split 01234567 into groups of three, product, cartesian product, then get the second to last element.

18

⌊………………………

floor(nothing) is 0, so then we just add 2 a bunch of times to get 18.

\$\endgroup\$
1 2
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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