154
\$\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\$
  • 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 Jun 4 '17 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\$ – Kevin Cruijssen Jun 6 '17 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\$ – Stewie Griffin Jun 6 '17 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\$ – Stewie Griffin Aug 18 '17 at 17:31
  • 1
    \$\begingroup\$ @StewieGriffin I would at least allow spaces, but hey, I'm not you. \$\endgroup\$ – tuskiomi Aug 18 '17 at 18:30

62 Answers 62

147
\$\begingroup\$

JavaScript (ES7), score 17, 176 bytes

They said it couldn't be done, so I did it :D (thanks to a lot of help from @FullDecent)

""**""
~(~/~//~/~/)/~/~/
3
4
!NaN- -!NaN- -!NaN- -!NaN- -!NaN
6
7
8
9
++[[]][+[]]+[+[]]
11
'lengthlength'.length
222>>2>>2
`${``^``}xE`^``
0XF
C=CSS==CSS;C<<C<<C<<C<<C
555555555555555555555%55

Unused characters:

#&,:?@ABDGHIJKLMOPQRTUVWYZ\_bcdfijkmopqrsuvwyz|

I don't think 18 is possible, but I said the same thing about 17...

Explanation

JavaScript is a very weakly typed language; if you try to perform a mathematical operation on a non-number value, JS will try its hardest to convert it to a number first. This allows for a lot of interesting solutions. I've tried to avoid using the digits as much as possible so they can be used later on.

  1. ** is the exponentiation operator in ES7. The empty string when coerced to a number becomes 0, so this calculates 0 ** 0, which is 1 according to JavaScript.
  2. A little ridiculous, but it works. /~/ is a regex literal, and ~/~/ returns -1, so this is ~(-1 / -1) / -1 = ~(1) / -1 = -2 / -1 = 2. (credits to @GOTO0 for the idea)
  3. Simply 3.
  4. Now simply 4.
  5. NaN is falsy, so !NaN is true, which is equivalent to 1. The expression thus becomes 1 - -1 - -1 - -1 - -1 = 1 + 1 + 1 + 1 + 1 = 5.
  6. Simply 6.
  7. Simply 7.
  8. Simply 8.
  9. Simply 9.
  10. This uses a little JSF*** magic. +[] is 0, so [[]][+[]] returns the first element of [[]] (that is, []), and ++ increments this to 1. Then +[+[]] adds the array [0], which is coerced to a string and makes "10".
  11. Simply 11. I originally had used 11&1111 for 3 and 33/3 for 11 until I realized yet again just how dumb I am...
  12. This strategy would work on any number: create a string of length 12 and use .length.
  13. I just messed around with 2s and >s for a while to get this one. I got lucky again: 222 >> 2 is 55, and 55 >> 2 is 13.
  14. This one is rather tricky. The basic idea is to create 14 in hex (0xE), but we need the digit 0 elsewhere. So instead we prepend the result of ``^`` to the string xE; the empty string coerced to a number is 0, so this returns 0 ^ 0 = 0. Then the result is XORed with the empty string, which converts both values to numbers; "0xE" ^ "" is 14.
  15. This is now pretty easy: 0XF is a hexadecimal literal with a value of 15.
  16. The trickiest of all? First we set the variable C to CSS == CSS (that is, true). Then we take the result and perform << C four times, which basically multiplies 1 by 2 ** 4.
  17. JavaScript starts to lose integer precision at 253, which allows 555...555%55 to return a number that's not 0 or 5. I happened to get very lucky while playing around here.

Strategies that would work on many numbers:

  • -!NaN would work on any number (currently 5), though it gets large very fast.
  • ~/~/ would work on any number (currently 2), though it gets very large very fast.
  • +[] would work on any number (currently 10), though it's by far easiest on 10 or 11.
  • .length would work on any number.
  • `${-``}xE`-`` would work on pretty much any number if you do it right.
  • C<<C would work on any power of two (currently 16), or any int at all if you included |.
\$\endgroup\$
  • 3
    \$\begingroup\$ That's pretty awesome :) \$\endgroup\$ – Steve Bennett Jun 6 '17 at 0:54
  • 1
    \$\begingroup\$ There might be some sneaky way to use one of the window. properties, like defaultPixelWidth, but they all seem to contain either l or e. You can get another 0 by URL | URL but it doesn't help much. \$\endgroup\$ – Steve Bennett Jun 6 '17 at 1:06
  • 1
    \$\begingroup\$ I also found "focus", but I'm still not seeing how to get to 18: "focus" is function(). "focus & focus" is 0. "focus(URL)" is undefined. \$\endgroup\$ – Xantix Jun 8 '17 at 1:44
  • 1
    \$\begingroup\$ Current found operators that increase: + - * ~ < x X length \$\endgroup\$ – l4m2 Mar 15 '18 at 22:44
  • 1
    \$\begingroup\$ The lack of numbers is mainly limited on these symbols. Any number contain one of 1 2 3 4 5 6 7 8 9 + - * ~ < x X length. So before solving it we can't go 18 \$\endgroup\$ – l4m2 Mar 16 '18 at 5:26
90
\$\begingroup\$

Jelly, 47 integers, 519 bytes

e
BI$⁼#
⁾⁾⁾Ụ^/
ı***ıḞḞ
5
6
7
.::::
9
EȮ<
⁻GṘ
=`p`VV×`DQV
~A~A~A~A~A~A~A~A~A~A~A~A~A
⁷ṾṾṾw
⁴ḟ€⁴Ṁ
mmmmċ
ṭṭṭṭṭṭṭṭḍḄḄḄḄḄḄḄḄḄ
+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ
CNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNC
ĖḌĖḌ
ṫṣȦJṫȦ⁸ȦJ
22
“@ṃ»
!ḤḤ!
³HH
ØaM
;;;;;;;;;;;;;;;;;;;;;;;;;;;¬¬ḅ¬
irið8c
⁶ḲĠṂ°İṂĊ
œṡ¹ẆẆTUṖṖṖṖP
ȷ½RṪ
LµdddddµFL
33
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWŒḊ
ẇɓæ«æ«æ«æ«æ«|æ«|
⁹ṚḢ²
‘‘‘0‘‘‘‘‘‘‘
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’ạ
-____---__________
”(O
⁵ḶxḶ⁵ị⁵ḶxḶḣṢ
⁽{ʂ%⁽{}
ẊẠżv©żvżvżvọ®®Ạżvżvżvọ®
44
111111l11&K1111111Kl11&
,SS¶ỊỊ,ÇS¶ÇÑÇÇÇÑ
ÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆn

Every line is a separate, full program.

Try it online! (includes test suite and intersection checker)

How it works

Every full program without command-line arguments executes its main link (defined on the last line) niladically, i.e., without input. If the first link in the chain is a nilad, it is consumed, called, and both the main link's argument and return value are set to the result; if the first link in the chain is a monad or a dyad, it is not consumed and the implicit argument and return value 0 is used instead. In both cases, the remainder of the chain is executed monadically.

Jelly mangles its output in several cases. Notably, a singleton array is printed without its surrounding brackets, so 42 and [42] and indistinguishable after printing. We'll use this on several occasions.

1 – 10

e

The exists atom tests if the return value 0 belongs to the argument 0. It does, so e returns 1.

BI$⁼#

BI$ is a quicklink, specifically a monadic chain formed by the quick $ grouping the binary atom B and the increments atom I. Combined, they convert an integer into the array of its digits in base 2, then compute the forward differences of the resulting digits. If the array has only one element, there are no forward differences and I returns an empty array (falsy); if there are at least two digits, I returns a non-empty array (truthy).

The quick # consumes the previous quicklink and applies it to 0, 1, 2, … until enough matches are found an returns the array of matches. The required amount is calculated by , which compares the return value/argument 0 to itself, yielding 1. Thus, the whole program returns [2], the first non-negative integer with two digits in base 2.

⁾⁾⁾Ụ^/

⁾⁾⁾ is a string literal, specifically the string ⁾⁾. The grade up atom sorts its indices by their corresponding values; since both characters are equal, this yields [1, 2]. The resulting array is reduced with bitwise XOR ^/, so the whole program returns 3.

ı***ıḞḞ

ı initializes argument and return value to the imaginary unit i. * is the exponentiation dyad, whose right argument defaults to the main link's argument. Thus, ***ı computes ((ii)i)i ≈ 4.81 + 0i, the atom (floor for real arguments, real part for complex ones) computes the real part (4.81), then floors, yielding 4.

5
6
7

These three programs consist of a single literal and do exactly what you'd expect.

.::::

The literal . is a shorthand for 0.5 and initializes argument and return value. The integer division dyad's (:) right argument defaults to the main links argument, so :::: computes 0.5/0.5/0.5/0.5/0.5, yielding 8.

9

Another literal.

EȮ<

The all equal atom E returns 1 if all elements in its argument are equal, and 0 if not. An integer argument z is promoted to [z], so E will returns 1 for the implicit argument 0.

Now, the output atom Ȯ prints 1 to STDOUT. We then compare 1 with the implicit argument 0 using the less than atom <. The result is (1 < 0) = 0, and it is printed implicitly when the program finishes.

11 – 20

⁻GṘ

The grid atom G tries to make a visually pleasing table from its argument. For a plain integer argument (here: 0), it simply wraps it in an array. The flat not-equal atom compares the implicit argument 0 with the result to the right ([0]), yielding 1 since its arguments are not equal. The representation atom prints 1 to STDOUT and returns its result. At the end of the program, the final return value is printed implicitly, so we end up with an output of 11.

=`p`VV×`DQV

The self quick ` turns a dyad into a monad by calling it with identical left and right arguments. First, =` compares the implicit argument 0 with itself, yielding 1.

The Cartesian product atom p expects lists as its arguments, so it promotes the integer 1 to the range [1, …, 1] = [1]. p` takes the Cartesian product of [1] and itself, yielding [[1, 1]].

The eval atom V turns all flat arrays (containing only numbers and characters) into strings, then evaluates the resulting strings as niladic Jelly programs. [[1, 1]] is first turned into [“11”], then V evals the string, yielding [11]. Once more, V turns this array into "11", then evals it to yield 11.

Now, ×` multiplies 11 with itself, yielding 121. The decimal atom turns 121 into [1, 2, 1], the unique atom Q discards the second 1, and V once more turns a list of digits into the integer that results from concatenating them, returning 12.

~A~A~A~A~A~A~A~A~A~A~A~A~A

~ is the bitwise NOT atom. With two's complement arithmetic, it maps an argument z to ~z = -(z+1). A is the absolute value atom, so it maps -(z+1) = z+1. With the initial return value 0, the thirteen copies of ~A return 13.

⁷ṾṾṾw

The constant holds the newline character '\n' and initializes the argument and return value.

The uneval atom attempts to create a string representation of its argument z such that a Jelly program consisting of this code would return z.

The first call dutifully returns the string "”\n", which is a character literal. The next call returns "””,”\n" – a pair of character literals. The third and final call returns "””,””,”,,””,”\n" – a quintuplet of character literals.

Finally, the window index atom w promotes its right argument '\n' to the string "\n" and find the first index of a substring starting with "\n". This returns 14.

⁴ḟ€⁴Ṁ

is the constant 16. The quicklink filterfalse each (ḟ€) promotes its left argument 16 to the range [1, …, 16], then iterates over its elements.

For each element z, ḟ⁴ is executed, first promoting z to [z], then removing all (if any) occurrences of 16. This yields the array [[1], [2], …, [14], [15], []], where the last array is empty because it contained 16.

Finally, the maximum atom selects [15].

mmmmċ

The modular atom m – called with arguments x (array) and y (integer) usually takes every |y|th element of x, starting with the first if y > 0, with the last if y < 0. However, when y = 0, it returns x concatenated with its reverse.

The left integer argument 0 is first promoted to [0]. The first copy of m concatenates [0] with itself, yielding [0, 0]. The remaining copies turn this result into [0, 0, 0, 0], then [0, 0, 0, 0, 0, 0, 0, 0], and finally [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].

At last, the count atom ċ counts the number of times the implicit argument 0 appears in the resulting array, returning 16.

ṭṭṭṭṭṭṭṭḍḄḄḄḄḄḄḄḄḄ

is the tack atom and appends its left argument to its right one. Since and the following are dyadic, all calls to pass the implicit argument 0 as the right argument to . The first call returns [0, 0], the second [0, [0, 0], and the eighth and last [0, [0, [0, [0, [0, [0, [0, [0, 0]]]]]]]].

is the divisibility atom; for arguments x and y, it returns 1 is x is divisible by y, 0 if not. is a no-op for integers, so ḍḄ tests 0 for divisibility by each integer in the constructed array. 0 is divisible by itself, so we get [1, [1, [1, [1, [1, [1, [1, [1, 1]]]]]]]].

Now, the unbinary atom operates on flat arrays. For a pair [a, b], it simply returns 2a + b. As mentioned earlier, is a no-op for integers: an integer argument c is promoted to [c], and [c] in any base is simply c.

The first call to reduces [1, 1] to 3, thus yielding [1, [1, [1, [1, [1, [1, [1, 3]]]]]]]. The next call reduces [1, 3] to 5, the next one [1, 5] to 7, and so forth until the ninth returns 17.

+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ+Ṇ

is the flat logical NOT atom and maps the implicit argument 0 to 1. + is the addition atom, so each of the eighteen copies of +Ṇ increment the previous return value (initially 0). The whole program thus returns 18.

CNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNCNC

C is the complement atom and maps its argument z to 1-z. N is the negate atom and maps its argument z to -z. Together, CN maps z to -(1-z) = z-1, so the eighteen copies turn the implicit argument 0 into -18. A final application of C yields 1 - (-18) = 19.

ĖḌĖḌ

The enumerate atom Ė enumerates the items in an array, creating index-value pairs. The implicit argument 0 is promoted to [0], then Ė yields [[1, 0]]. The undecimal atom converts a flat array from base 10 to integer, yielding [10] in this particular case.

The second call to Ė transforms [10] into [[1, 10]], which the second finally transforms into [20].

21 – 30

ṫṣȦJṫȦ⁸ȦJ

The tail atom (a dyad) select the postfix of its left argument that starts at the index (1-based and modular) specified in its right argument, promoting a left integer argument x to [x]. When called with both arguments set to 0, returns [0].

The any and all atom Ȧ returns 1 if its argument is truthy and contains no zeroes at any depth, 0 otherwise. Here, we simply use it as an identity function to return the implicit argument 0. The split at atom partitions its left argument [0] at occurrences of its right argument 0, so it returns [[], []] here.

The indices atom J discards the elements of the return value and replaces them with their indices, yielding the range [1, 2] in this specific case. Ȧ and both work as before, so they reduce [1, 2] to the postfix that starts at the last index, yielding [2].

In niladic links, the constant holds []. This is an unparseable nilad, i.e., it doesn't fit into the chain in any way. As a result, the previous return value ([2]) is printed to STDOUT, then replaced with the nilad's value ([]).

Since [] is falsy, Ȧ transforms it into 0. The J atom promotes 0 to [0], then returns the list of its indices ([1]), which is printed implicitly when the program finishes.

22

Another literal. Repdigits seem to be the best place to use them.

“@ṃ»

This uses Jelly's inbuilt string compression. The indices of @ and in Jelly's code page are 64 and 220 and string literals can contain 250 different characters, so this first computes the integer 250 × 65 + 220 = 16470.

16470 is divisible by 3, so the quotient 16470/3 = 5490 encodes a printable ASCII character or a linefeed. There are 96 of these and 5490 = 96 × 57 + 18, meaning that we've decoded the printable ASCII character at the 0-based index 18, which is '2'.

We're left with 57, which is also divisible by 3, so the quotient 57/3 = 19 = 96 × 0 + 19 encodes printable ASCII character at the 0-based index 18, which is '3'.

This leaves 0; the decoding process stops. The generated characters are concatenated to form "23"

!ḤḤ!

The factorial atom ! turns the implicit argument 0 into 1. Two invocations of the unhalve atom turn 1 into 2, then 2 into 4. Finally, ! computes 4! = 24.

³HH

In absence of command-line arguments, the constant ³ holds 100. Two invocations of the H turns 100 into 50, then 50 into 25.

ØaM

The constant Øa holds the lowercase alphabet. The maximal atom M yields all indices of maximal items, and since z is the largest lowercase letter, the result is [26].

;;;;;;;;;;;;;;;;;;;;;;;;;;;¬¬ḅ¬

Twenty-six copies of the concatenate atom ; concatenate the initial return value 0 and twenty-six instances of the default argument 0, building an array of 27 zeroes.

¬ is the logical NOT atom, so appends a 1 to the array of zeroes. The next ¬ negates all elements in the array, leaving us with an array of 27 ones and 1 zero.

is the unbase atom and converts a digit array from its left argument from the base specified in its right argument to integer. ḅ¬ converts from unary to integer, so it simply performs a sum. For an array of 27 ones, this returns 27.

irið8c

The index of atom i promotes its left argument 0 to [0], then find the index of its right argument 0 in that array, yielding 1.

The range atom r constructs an ascending or descending range from it's left argument to its right one. The right argument is the implicit argument 0, so this yields [1, 0]. A second invocation of i finds the index of 0 in [1, 0], yielding 2.

ð begins a new, dyadic chain. Since the preceding chain was niladic, both left and right argument of this chain will be equal the first chain's return value (2). c in the combinations atom. With left argument 8 and right argument 2, it counts all unique, unordered 2-combinations of a set of 8 elements, returning 8C2 = 8!/(6!2!) = 28.

⁶ḲĠṂ°İṂĊ

The constant holds a space character and sets argument and return value to ' '. The words atom promotes the character ' ' to the singleton string " " and splits it at spaces, yielding [[], []].

The group atom Ġ groups all indices of equal elements. Since both elements of the last return value are equal, it returns [[1, 2]] here. The minimum atom extracts a minimal (the only) element of this array, yielding [1, 2].

The degree atom ° converts both integers from sexagesimal degrees to radians, yielding 1° × 2π/360° = π/180 and 2° × 2π/360° = π/90. The inverse atom takes the multiplicative inverses, yielding 180/π ≈ 57.3 and 90/π ≈ 28.6.

Then, once more takes the minimum, yielding 28.6. Finally, the ceil atom Ċ transforms 28.6 into 29.

œṡ¹ẆẆTUṖṖṖṖP

The identity atom ¹ returns 0 for the implicit argument 0. The split around atom œṡ promotes both of its arguments (both 0) to [0], then splits [0] around contiguous subarrays equal to [0]. This yields [[], []].

The sliding window atom builds all contiguous subarrays of its argument. The first instance transforms [[], []] into [[[]], [[]], [[], []]], the second instance transforms [[[]], [[]], [[], []]] into
[[[[]]], [[[]]], [[[], []]], [[[]], [[]]], [[[]], [[], []]], [[[]], [[]], [[], []]]].

The truth atom T lists all indices of truthy elements. None of the arrays at the first level are empty, so this yields [1, 2, 3, 4, 5, 6]. The upend atom U reverses this array, yielding [6, 5, 4, 3, 2, 1].

Four copies of the pop atom remove the last four elements, leaving us with [6, 5]. Finally, the product atom P transforms this array into 30.

31 – 40

ȷ½RṪ

ȷ is a shorthand for 1 × 103 = 1000. The square root atom ½ yields 31.6, which the range atom R transforms into [1, …, 31]. Finally, the tail atom extracts the last element, returning 31.

LµdddddµFL

The length atom L promotes the implicit argument 0 to [0], then takes the length to yield 1. µ starts a new, monadic chain, and the result 1 becomes its argument.

For arguments x and y, the divmod atom d yields [x/y, x%y]. Each call will have y = 1, so the result will always be [x, 0].

The first call starts with x = 1, yielding [1, 0]. d only operates on integers, so it vectorizes in subsequent calls. The second call yields [[1, 0], [0, 0]], the third [[[1, 0], [0, 0]], [[0, 0], [0, 0]]], and the fifth and last one an array of depth 5 that contains a single one and 31 zeroes.

µ once more starts a new, monadic chain, and the array from before becomes its argument. The flat atom F unnests this array, yielding a flat array of a single one and 31 zeroes. Finally, L takes the length of the resulting, returning 32.

33

Another repdigit, another literal.

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWŒḊ

Each instance of the wrap atom transforms its argument z into [z]. With the initial return value of 0, all 34 instances together yield [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]. Finally, the depth atom ŒḊ computes the maximal depth of the resulting array, returning 34.

ẇɓæ«æ«æ«æ«æ«|æ«|

The window exists atom promotes both of its arguments (both default to 0) to [0], then tests if**[0]** occurs as a contiguous subarray of [0]. It does, so returns 1.

ɓ begins a new, dyadic chain. Since the preceding chain was niladic, both left and right argument of this chain will be equal the first chain's return value (1). The chain makes use of two different, dyadic atoms: bitshift left (æ«) and bitwise OR (|).

A dyadic chain that starts with three or more dyads initially calls the first dyad with the chain's arguments. Here, this gives 1 << 1 = 2. The six subsequent dyads are grouped into pairs (so-called forks), where the rightmost dyad is called first with the chain's arguments, then the leftmost one is called with the previous return values to both sides.

For æ«æ«, we get 2 << (1 << 1) = 2 << 2 = 8. Then, æ«æ« computes 8 << (1 << 1) = 8 << 2 = 32. Now, |æ« gets us 32 | (1 << 1) = 32 | 2 = 34.

Finally, the trailing | acts like a hook and is called with the previous return value as its left argument and the chain's right argument as its right one. This returns 34 | 1 = 35.

⁹ṚḢ²

In absence of a second argument, the constant holds 256. The reverse atom promotes 256 to the array [2, 5, 6] and reverses it to yield [6, 5, 2]. Then, the head atom extracts the first element, and the square atom ² returns **6² = 36*.

‘‘‘0‘‘‘‘‘‘‘

The increment atom increments its argument by 1, so ‘‘‘ turn the initial return value 0 into 3. The following 0 is an unparseable nilad, i.e., it doesn't fit into the chain in any way. As a result, the previous return value (3) is printed to STDOUT, then replaced with the nilad's value (0).

The following 7 copies of turn this 0 into 7, which is printed implicitly when the program finishes.

’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’ạ

The decrement atom decrements its argument by 1, so thirty-eight copies turn the initial return value 0 into -38. The absolute difference atom computes the unsigned difference between -38 and the implicit argument 0, returning 38.

-____---__________

- is a shorthand for -1 and sets the link's argument and return value to -1. Each _ is an instance of the dyadic subtraction atom, whose right argument will default to -1 if missing.

First, -____- computes (-1) - (-1) - (-1) - (-1) - (-1) = 3. The following -1 is an unparseable nilad, so the previous return value (3) is printed to STDOUT, then replaced with the nilad's value (-1).

Next, -_ computes (-1) - (-1) = 0, where the literal - sets the left argument of _ and uses the return value as the right one. The following nine copies of _ subtract the default argument -1 from the return value, yielding 9, which is printed implicitly when the program finishes.

”(O

”( is a character literal and the ordinal atom O looks up its Unicode code point, yielding 40.

41 – 47

⁵ḶxḶ⁵ị⁵ḶxḶḣṢ

In absence of a third command-line argument, the constant holds 10. The unlength atom creates a 0-based range, specifically [0, …, 9] for argument 10, to both sides of the repeat in place atom x. The latter matches elements of its left argument with repetitions of its right one, and repeats each of the elements the corresponding number of times. With [0, …, 9] as both left and right argument, we thus get zero zeroes, one one, two twos, etc.

The index into atom fetches the element of its right argument at the index specified in its left one. With left argument 10 ( to its left) and right argument [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, …, 9] (previous result), this gives 4.

The chain up to this point is followed by an unparseable nilad , so the previous return value (4) in printed to STDOUT, the return value is set to 10, and the rest of the chain is parsed as usual.

As before, ⁵ḶxḶ will yield the array [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, …, 9]. This time, we call the sorted atom on the argument 10, which promotes 10 to [1, 0], then sorts it to yield [0, 1]. The dyadic head atom now fetches the prefixes of lengths 0 and 1 from the result to the left, leaving us with [[], [1]]. When printed, nothing but 1 will remain visible.

⁽{ʂ%⁽{}

and its two following characters constitute a numeric literal. If j and k are their code points in Jelly's code page and (j, k) < (124, 250), we get the integer 1001 + 250j + k. The code points of '{', '}', and 'ʂ' are 123, 125, and 167, so the left literal evaluates to 1001 + 250 × 123 + 167 (= 31918), while the right one evaluates to 1001 + 250 × 123 + 125 (= 31876).

Since the left integer is less than twice as big as the right one, the result is (… + 167) % (… + 125) = (… + 167) - (… + 125) = 167- 125 = 42.

ẊẠżv©żvżvżvọ®®Ạżvżvżvọ®

The shuffle atom randomizes the order of its argument's elements; a numeric argument z is promoted to the range [1, …, z] beforehand. For the implicit argument 0, this range is empty and yields []. The all atom returns 1 if all of its argument's elements are truthy, 0 if not. Since an empty array does not contain falsy elements, returns 1 here.

The zip with atom ż (a dyad) takes arguments x and y and transposes the pair [x, y]. For integers x and y, this simply yields [[x, y]], so this particular ż, called with arguments 1 and 0 (the implicit argument), returns [[1, 0]]. The dyadic eval atom v turns all flat arrays (containing only numbers and characters) i the left argument into strings, then evaluates the resulting strings as monadic Jelly programs with its right argument as the programs' arguments. Since ["10"] consists solely of literals, this ignores the right argument of v and simply results in [10].

The copy quick © attaches to v and copies its result into the register. Later occurrences of the recall atom ® (a nilad) will fetch [10] from the register.

The next three copies of żv work as before, mapping [10] to [[10, 0] to [100] to … to [10000]. The order atom tests how many times its left argument is divisible by its right one, so here, it computes the order of 10 (fetched with ®) in 10000 = 104, yielding [4].

The following ® is an unparseable nilad, so the previous return value ([4]) is printed to STDOUT, then replaced with the nilad's value (10). We apply next, yielding 1. (This is required as a nilad followed by a dyad would be parseable at this point.)

As before, żvżvżv appends three zeroes to the current return value, turning 1 into [1000]. Finally, ọ® computes the order of 10 in 1000 = 103, and 3 is printed to STDOUT when the program finishes.

44

Yet another repdigit, yet another literal.

111111l11&K1111111Kl11&

First and foremost, the literal 111111 sets the argument and initial return value to 111111. The other runs of 1 are also literals.

l is the logarithm atom , which computes the logarithm of its left argument to the base specified in the right one. When called on 111111 with right argument 11, we get log11111111 ≈ 4.85.

The words atom K joins a list argument at spaces, after promoting a numeric/character z to [z]. Here, we simply use it to turn the link's argument 111111 into [111111]. (We do not require an array here, but we have run out of identity atoms.) The bitwise AND atom & takes the return values to both sides, casts them to integer if required, and computes their bitwise AND. In this particular case, it returns [4.85 & 111111] = [4 & 111111] = [4].

The following 1111111 is an unparseable nilad, so the previous return value ([4]) is printed to STDOUT, then replaced with the nilad's value (1111111). K then turns this integer into [1111111]. (This is once again not really required, but a nilad followed by a dyad would be parseable at this point.)

As before, l11 computes log111111111 ≈ 5.81, then & returns [5.81 & 111111] = [5 & 111111] = [5].

,SS
ỊỊ,ÇS
ÇÑÇÇÇÑ

This is the only program that consists of multiple user-defined links. The last link is the main link and executes when the program starts, the remaining ones are helper links. The quick Ç always refers to the link above the current one and executes it monadically. Likewise, the quick Ñ always refers to the link below the current one (wrapping around) and also executes it monadically.

The top link consists of the pair atom , – a dyad that turns arguments x and y into [x, y] – and the sum atom S – a monad that promotes an integer argument z to [z] and reduces an array argument by addition. When the link ,SS is called with an integer argument n, it computes Σ[n, Σn] = Σ[n, n] = 2n.

The middle link consists of the above atoms, the aforementioned quick Ç, and the insignificant atom – a monad that yields 1 for numeric arguments z with -1 ≤ z ≤ 1, but 0 for all others. Applying twice to an integer argument n essentially replaces it with 1, as the output of the first (the input of the second one) is always insignificant. This result is then paired with the return value of Ç (called with argument n), and the resulting pair is reduced by S. In total, we compute Σ[(|n| ≤ 1) ≤ 1, 2n] = Σ[1, 2n] = 2n + 1.

With these two helper links in place, the main link can now construct any non-negative integer by looking at its binary digits. With an initial return value of 0, the chain ÇÑÇÇÇÑ computes the final result (((((0 × 2 + 1) × 2) × 2 + 1) × 2 + 1) × 2 + 1) × 2 = ((5 × 2 + 1) × 2 + 1) × 2 = 46.

ÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆnÆn

The next prime atom finds the smallest positive prime number that is strictly greater than its argument. With initial return value 0, fifteen invocations of Æn compute the fifteenth prime number, which is 47.

\$\endgroup\$
  • 7
    \$\begingroup\$ I've been spending all day trying to catch up to Neim's 38 and then I scroll down and see this. Challenge accepted! \$\endgroup\$ – Shaggy Jun 5 '17 at 0:17
  • 1
    \$\begingroup\$ TL;DR You got it to count to 47, and you are a wizard at Jelly. \$\endgroup\$ – cascading-style Jun 7 '17 at 6:04
  • \$\begingroup\$ Are all of the "atoms" single bytes as requested in the challenge? If so, which encoding is this? \$\endgroup\$ – M.Herzkamp Jun 7 '17 at 15:11
  • 4
    \$\begingroup\$ @M.Herzkamp Jelly uses its own code page. \$\endgroup\$ – Dennis Jun 7 '17 at 18:34
  • 1
    \$\begingroup\$ I read the explanation in detail for the first time now. This is truly impressive. Some of these are just ridiculous :-) \$\endgroup\$ – Stewie Griffin Aug 7 '18 at 23:44
62
\$\begingroup\$

brainfuck, score 2, 255 144 10 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. I think this is all that's possible. :P This answer demonstrates six of the eight characters brainfuck uses, the other two being ,, which is input and ., which is output.

+
>--[<->-]

Visualize it online!

Explanation

Every number is created and stored on the starting cell on the tape. Heavily relies on the wrapping cells, which are not implemented in a few interpreters.

1:

[ 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
  ^

+  increment the current cell

[ 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
  ^

2:

[ 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
  ^

>  move to the next cell
-- decrement the current cell twice

[ 0 |254| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
      ^

[  while the current cell is not 0
<  move to the previous cell
-  decrement the current cell

[255|254| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
  ^

>  move to the next cell
-  decrement the current cell

[255|253| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
      ^

]  repeat while the current cell is not 0

...

[ 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
      ^

[ 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
  ^

[ 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 ]
      ^
\$\endgroup\$
  • 5
    \$\begingroup\$ Now do it in brain-flak. :P \$\endgroup\$ – DJMcMayhem Jun 5 '17 at 20:07
38
\$\begingroup\$

Neim, score 38, 327 bytes

1: 𝔼
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
10: β
11: γ
12: δ
13: ε
14: ζ
15: η
16: θ
17: ι
18: κ
19: λ
20: μ
21: ν
22: ξ
23: π
24: ρ
25: σ
26: ς
27: τ
28: υ
29: φ
30: χ
31: ψ
32: ω
33: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
34: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<𝐀
35: 𝐓0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻0𝐓𝔻
36: ℂ𝐋𝐠𝐋𝐠𝐋𝐠𝐋𝐝𝐬𝕏𝐬
37: α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊α𝕊
38: 𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝔸𝐥

Explanation:

  • For 1, we use the 'check for equality' token, here exploiting that when Neim attempts to pop on empty input, it gets 0. As 0 and 0 are equivalent, this pushes 1 which is implicitly printed
  • From 2 through 9, we just use numeric literals.
  • From 10 through 32, Neim actually has one byte constants for all of them (yes, it's crazy).
  • For 33, we only use the increment command. On the first byte, Neim tries to pop something so it can increment it, but since the input is empty, it defaults to popping 0.
  • For 34, we use the same approach, but decrementing, and taking the absolute value.
  • For 35, we are exploiting the fact that zero factorial is one, and we use that by duplicating the one and repeatedly adding
  • For 36, we use to check 0 and 0 for co-primality, which they are. This pushes 1. Then we get the first prime using 𝐋, which results in a singleton list containing just 2. We then get the greatest element (𝐠), which pushes 2 as a number. Then we repeat this process until we get the list [2 3 5 7 11]. After that, we use 𝐝 to calculate the deltas, resulting in the list [1 2 2 4]. Next, we use 𝐬 to get the sum - which is 9 - then we calculate exclusive range from 0 to 9, resulting in [0 1 2 3 4 5 6 7 8]. Finally, 𝐬 is used again to get 37.
  • For 37, α is a constant that represents negative one, and we repeatedly push it and subtract (again exploiting the fact that when we attempt popping on empty input, 0 is pushed)
  • For 38, once again using the default 0 for empty input, we keep appending 0 to itself, creating a long list, then calculating the length.

Can be tried here

\$\endgroup\$
  • 3
    \$\begingroup\$ You have mixed up something around 36-37. \$\endgroup\$ – Erik the Outgolfer Jun 4 '17 at 19:53
  • 2
    \$\begingroup\$ Aren't those special characters encoded with more than 1 byte though? If so, that would make it 860 Bytes according to mothereff's byte counter and the challenge rules state that all characters must be encoded using a single byte in the language you choose. Does Neim encode those special characters in only 1 byte? How? \$\endgroup\$ – Hankrecords Jun 5 '17 at 14:11
  • 8
    \$\begingroup\$ @Hankrecords Neim uses a custom codepage \$\endgroup\$ – Okx Jun 5 '17 at 14:47
  • 2
    \$\begingroup\$ You haven't used the character 1 yet. Surely you can put that to some use? \$\endgroup\$ – Bergi Jun 8 '17 at 1:53
34
\$\begingroup\$

Python 2, 15

Here's a start, looking for more

Thanks to leo whose tip helped me to get to 15

[[[]]>[]][[]>[]]>>[[]>[]][[]>[]]

2

import math
print'%i'%math.pi

((()<())<())<<((()<())<())<<((()<())<())

5

6

7

8

9

11^1 

33/3

4--4--4

__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__+__debug__

q=""=="";qq=q=="";qqq=~q*~q*~q;~qqq*~q*~qq

0xF
\$\endgroup\$
  • 2
    \$\begingroup\$ You could use -~-~-~-~-~-~-~-~-~[[]==[]][[]<[]] for 10 and 0xD for 13 for a lower total byte count \$\endgroup\$ – ovs Jun 3 '17 at 14:54
  • \$\begingroup\$ Could you some how use the fact that ''is'' evaluates to true to make another number? \$\endgroup\$ – Notts90 Jun 3 '17 at 20:25
  • \$\begingroup\$ @Nots90 Unfortunately I'm out of operations To make anything out of it. If you find any way of making new numbers or if booleans let me know \$\endgroup\$ – Wheat Wizard Jun 3 '17 at 21:00
  • 1
    \$\begingroup\$ 14 is missing a closing parens: ((()<((),))|(()<((),))<<(()<((),))|(()<((),))<<(()<((),))<<(()<((),)))<<(()<((),)) \$\endgroup\$ – TemporalWolf Jun 5 '17 at 23:34
  • 1
    \$\begingroup\$ For the record, your latest rev hasn't used the following from string.printable: c, j, k, l, s, v, w, y, z, A, B, C, D, E, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, !, #, $, &, ., :, ?, @, \\, `, {, }, \t, \r, \x0b, \x0c \$\endgroup\$ – wnnmaw Jun 7 '17 at 21:28
23
\$\begingroup\$

Japt, 448 bytes, score 42

A large collaboration between Shaggy, ETHproductions, & Oliver.

v
y
Íà
Qiiii)iiii)âQ
ÂHq
LÁL
´Vn´VnVnVn
8
9
A
B
C
D
E
F
G
J-----J---J---J---J
[¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾]x
;Iìw
~~½e½e½e½e~½e½
++T+++T+++T+++T+++T+++T
22
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
4á
5²
°UU°°°U°°U°°U°°U°°U
»³³
7/¼
$'_____________________________b'$bb
ZµÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"aa
Sc
33
Mg011
##
6p
Rí í í í í è.
`¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥`l
¨N|N¹òò¹m···m|¹mò¹m···m|¹mò¹m···m|¹o
º¤¤*º¤*º¤
(Å<<(Å<<(Å<<(Å<<(Å<<(Å^(Å<<(Å<<(Å<<(Å^(Å
Y±Y¶YY±YY±Y±Y¶YY±YY±Y±Y¶YY±Y

These (useful) chars are left:

!%&,:=>?@OPWX\dfhjkrstuz{}¡¢£¦§©ª«¬®¯¸ÀÃÆÇÈÐßãäåæçéêëîïñóôõö×øÿ

Explanations

A couple of things to know about Japt before we start, that I've made frequent use of. Firstly, Japt has 6 variables reserved for input, those being the uppercase letters U-Z. If no input is passed through those variables, they all default to 0. The second thing is covered in this tip.

Click on any snippet to try it in the online interpreter.


v

When applied to a number, the v method takes an integer n as an argument, and returns 1 if the number is divisible by n, 0 if not. If n isn't supplied then it defaults to 2. 0 (the default value for U) is divisible by 2, so this gives us our 1.


y

Very similar to the first one. When applied to a number, the y method takes an integer n as an argument, and returns the GCD of the two numbers. If n isn't supplied then it defaults to 2. Since 0 is divisible by 2, GCD(0, 2) gives us our 2.


Íà
Í is the shortcut for n(2) or 2-this. Because we have no input, we default this to 0, which results in 2-0 = 2.

à returns the number of combinations of [1...this], which returns 3


Qiiii)iiii)âQ

Q defaults to a single quotation mark. i on a string inserts another string at the beginning; as explained in #3, each iiii) is equivalent to .i("i".i("i")) in JS, thus inserting two copies of i at the beginning of the string. Do this twice and you have the string iiii". âQ then simulates .search(Q), giving the index of the first " in the string, which is 4.


ÂHq
H is the constant for 32. When applied to a number the q method, which takes integer n as an argument, returns the nth root of that number. If n is not supplied the default value is 2 so Hq gives us the square root of 32 which is approximately 5.6568. Â is the shortcut for ~~, which floors the result, giving us 5.


LÁL
L is preset to 100, and Á is the shortcut for >>> (zero-fill bitwise right shift). 100>>>100 is the same as 100>>>4 (the right operand wraps mod 32), which is 6.


´Vn´VnVnVn

As noted before, V defaults to 0. ´ is the shortcut for the -- operator, so the code is equivalent to the following JS:

(--V).n((--V).n(V.n(V.n())))

X.n(Y) is equivalent to Y - X, or -X + Y; the first --V returns -1, and the second -2, so this is about equivalent to -(-1) + (-(-2) + (-(-2) + -(-2))). Simplifying, we get 1 + 2 + 2 + 2 = 7.


8
9

Literally, 8 and 9.


A
B
C
D
E
F
G

These are the constants for 10-16, inclusive.


J-----J---J---J---J

J is preset to -1. The Japt interpreter somehow manages to parse this correctly, as (J--) - (--J) - (--J) - (--J) - (--J). Doing some more math, we find that this is equivalent to (-1) - (-3) - (-4) - (-5) - (-6), or -1 + 3 + 4 + 5 + 6 = 17.


[¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾]x

¾ is, as you might guess, a shortcut for .75. We put 24 copies of 0.75 in an array, then sum with x, giving 0.75 * 24 = 18.


;Iìw

I think this is my favourite one. ; at the beginning of the program changes the values of some of the Japt constants; without it I is 64, but with it, I is 91. ìw converts it to a list of digits and runs w on the list, reversing the array, then converts back to a number to get us 19.


~~½e½e½e½e~½e½
½ is a shortcut for .5. e on a number x takes in an argument y and returns x * 10y. So the chain of calculations that happens is:

           ½e½     1.5811  (.5 * sqrt(10))
          ~       -2
        ½e         0.005  (.5 * (10 ** -2))
      ½e           0.5058
    ½e             1.6024
  ½e              20.0138

And the final ~~ serves to floor this to an integer, yielding our result of 20.


++T+++T+++T+++T+++T+++T
T is preset to 0. ++ is the increment operator in JS and also in Japt; T+++T is parsed as (T++) + T, but ++T+++T is parsed as (++T) + (++T), so this is equivalent to the JS code

(++T) + (++T) + (++T) + (++T) + (++T) + (++T)

The result is 1 + 2 + 3 + 4 + 5 + 6, which sums to 21.


22

A literal 22.


ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

Ä is a shortcut for +1, so this simply sums 23 1s.


This finds the number of permutations of [1, 2, 3, 4], which is 4! = 24.


² is a shortcut for p2, which raises a number to the power of two. 5 ** 2 is 25.


°UU°°°U°°U°°U°°U°°U

° is a shortcut for the ++ operator, or if it cannot be parsed as such, + +. As noted before, when there is no input, U defaults to 0. So the code is equivalent to (++U), (U++) + + (++U) + + (++U) + + (++U) + + (++U) + + (++U), which is very similar to #17: U is first incremented to 1, then repeatedly incremented and added such that the final result is 1 + 3 + 4 + 5 + 6 + 7 = 26.


»³³

³ is the shortcut for the p method with an argument of 3. However, if a lowercase letter appears directly after a left-parenthesis (» is the shortcut for ((), it becomes a string. This lets it get passed to a method and called as a function (i.e. would be mapping by .p(3)). In this case, however, ("p",3) returns our3, then we raise it to the power of 3 (p is the power method when applied to a number), which gives us our 27 .


7/¼

¼, as you probably know by now, is a shortcut for .25, so this calculates 7 / 0.25 = 28.


$'_____________________________b'$bb

Anything wrapped in $ symbols is treated as pure JavaScript, so we've got a string of 29 underscores followed by a b. (Without the $, ' would be a single-character string.) The b method when applied to a string returns the first index of its argument within that string. As explained in #3, the last b is converted to a string, so we're grabbing the first index of b in our string, which is 29.


ZµÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ

µ is a shortcut for -=, and É for -1. The effect is subtracting 30 copies of -1 from 0, which gives 30.


"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"aa

Very much like #29. The a method, when applied to a string, returns the last index of its argument in that string. Using 0-indexing, the last index of a in a string of 32 as is 31.


Sc

S is predefined to a single space, and c on a single-char string returns its char-code, giving 32.


33

Literal 33.


Mg011

MgN returns the Nth Fibonacci number. 011 is 9 in octal; the 9th Fibonacci number is 34.


##

# returns the char-code of the next character. The char-code of # itself happens to be 35, making our job here especially easy.


6p

p is exponentiation, and without a second argument it defaults to 2; thus, this prints 6 ** 2 = 36.


Rí í í í í è.

This one is rather tricky. R defaults to a single newline character (that it's a newline becomes important later). í on a string, without any arguments, takes each character and appends its index: a rather useless transformation, but the result through 5 iterations is this: (using R instead of a literal newline)

R
R0
R001
R0010213
R001021304251637
R0010213042516370849210511112613314715

Interesting how each entry is simply a prefix of the next... But anyway, the last part, è., counts how many matches of /./g are found in the result. There are 38 chars in the string; however, since /./g only matches non-newline chars, the result is 37.


¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥l

Backticks mark a compressed string, and ¥ decompresses to ll. l on a string gives length, so after decompression, this gives 38.


¨N|N¹òò¹m···m|¹mò¹m···m|¹mò¹m···m|¹o

Oooh boy, this one's a doozy. First, we generate true with ¨N (¨ stands for >=, and N with no inputs is the empty array), then convert that to 1 with |N. From there on out it gets pretty crazy:

ò    Inclusive range [0..1],            [0, 1]
 ò   making each an inclusive range.    [[0], [0, 1]]
m·   Join each on newlines.             ["0", "0\n1"]
·    Join on newlines.                  "0\n0\n1"
·    Split on newlines.                 ["0", "0", "1"]
m    Map each item X and index Y to     
 |     X | Y.                           ["0" | 0, "0" | 1, "1" | 2] -> [0, 1, 3]
m    Map each by 
 ò     inclusive range.                 [[0], [0, 1], [0, 1, 2, 3]]
m··· Same as before.                    ["0", "0", "1", "0", "1", "2", "3"]
m|   Bitwise OR thing again.            [0, 1, 3, 3, 5, 7, 7]
mò   Map each by inclusive range.       [[0], [0, 1], ..., [0, 1, 2, 3, 4, 5, 6, 7]]
m··· Same as before.                    ["0", "0", ..., "5", "6", "7"]
m|   Bitwise OR again.                  ["0"|0, "0"|1, ..., "5"|30, "6"|31, "7"|32]
                                        -> [0, 1, ..., 31, 31, 39]

(The ¹s are just substitutes for close-parens and have been omitted.) The final o then pops and returns the final item in the array, giving 39.


º¤¤*º¤

Mostly the same trick as with #3. ¤ is the shortcut for the s method with an argument of 2. In this case, however, the transpiled code is (("s", 2).s(2) * (("s", 2) * (("s", 2)))), or simplified, (2).s(2) * (2 * 2). .s(2) returns the number as a base-2 string, which gives "10"; * (2 * 2) implicitly converts this to a number and multiplies by 4, giving 40.


(Å<<(Å<<(Å<<(Å<<(Å<<(Å^(Å<<(Å<<(Å<<(Å^(Å

Similar to the previous one. Å is the shortcut for the s method with an argument of 1. In this case, however, each transpiles to ("s", 1), which just returns 1. 1<<1<<1<<1<<1<<1 is 32, and 1<<1<<1<<1 is 8; these are XORed together with 1 to get 41.


Y±Y¶YY±YY±Y±Y¶YY±YY±Y±Y¶YY±Y

± is a shortcut for +=, and for ===. This means that the code is actually

Y+=Y===Y,Y+=Y,Y+=Y+=Y===Y,Y+=Y,Y+=Y+=Y===Y,Y+=Y

Y===Y is always true, so we can simplify this some:

Y+=1,Y+=Y,Y+=Y+=1,Y+=Y,Y+=Y+=1,Y+=Y

0 + 1 = 1; 1 + 1 = 2; 2 + (2+1) = 5; 5 + 5 = 10; 10 + (10+1) = 21; 21 + 21 = 42.

\$\endgroup\$
  • \$\begingroup\$ Wow, this is getting great now :-) You could use Iq for 8 to get 8 back, you'd have to find something else for 19 though. \$\endgroup\$ – ETHproductions Jun 4 '17 at 14:19
  • \$\begingroup\$ @ETHproductions: just used q for 5 allowing me to use l to add an extra number. Working on an alternative for 2 so I can get the = back. \$\endgroup\$ – Shaggy Jun 4 '17 at 15:08
  • \$\begingroup\$ @Shaggy You can use for 2. L>>L can free up 6. #w s Å can free up ; and I \$\endgroup\$ – Oliver Jun 4 '17 at 17:55
  • \$\begingroup\$ Nice trick for 2, @obarakon; I used something similar to free up 3, too. Unfortunately that won't work for 19 as I've already used # for 21. \$\endgroup\$ – Shaggy Jun 4 '17 at 18:54
  • \$\begingroup\$ I think you can swap 22 with 18 to save a few bytes and get back * and ^ \$\endgroup\$ – ETHproductions Jun 8 '17 at 13:43
18
\$\begingroup\$

PHP, score 17, 130 Bytes

characters used ADEFGIKLMOPRSTVXYZ=_![]()<>'"#$,;/-+*|^&0123456789afhnprstwx

Z==Z
FTP_MOREDATA
';'&w
![]<<![]<<![]
5
6
"#"|"$"|"1"
8
SIGKILL
333333>>3>>3>>3>>3>>3
99/9
22-2-2-2-2-2
strspn(XXXXXXXXXXXXXX,X)
7+7
0xf
4*4
ha^YV

1 Boolean constant Z (not set) equal constant Z

2 FTP_MOREDATA is a constant in PHP with the value 2

3 bitwise and chars ; and w

4 bitwise Shift left and logical not cast empty array to boolean true with is cast to integer 1 through the shift left operator

7 bitwise Or chars # and $ and 1

9 SIGKILL is a constant in PHP with the value 9

10 bitwise Shift right every step is an integer division with 8 so we have the steps 333333, 41666, 5208, 651, 81 ,10

13 count char X in the string X... from the beginning

15 hexadecimal value f = 15

17 bitwise Xor with the strings ha and YV

All snippets are items in an array

Try it online!

PHP, score 16, 94 Bytes

characters used AEIMPRTUZeflnrstvwx^_&|()[]=!.*+/-<>$":0123456789

Z==Z
":"&"w"    
M_PI|[]
TRUE<<TRUE<<TRUE
5
6
A^v    
8
9
!$s.strlen($s)    
77/7
3+3+3+3
111>>1>>1>>1    
22-2-2-2-2
0xf
4*4

1 Boolean constant Z (not set) equal constant Z

2 bitwise and chars : and w

3 Pi casted to integer value through empty array casted to zero

7 bitwise xor chars A and v

10 variable $s not set !$s = one concat with string length of variable $s

13 111 /2 =55 /2 =27 /2 = 13 Integer division bitwise

15 hexadecimal value f = 15

All snippets are items in an array

Try it online!

PHP, score 14, 84 Bytes

characters used $!_^[]()%/+~-=AEILMNPRUZ0123456789delnrstx

Z==Z
2
M_PI^[]
4
5
6
ERA%11
8
9
!$s.strlen($s)
77/7
3+3+3+3
0xd    
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-NULL

1 Boolean constant Z (not set) equal constant Z

3 Pi casted to integer value through empty array casted to zero

7 ERA is a constant with the value 131116 mod 11 = 7

10 variable $s not set !$s = one concat with string length of variable $s is zero

13 hexadecimal value d = 13 14 bitwise not and minus sign raise NULL to 14

All snippets are items in an array

Try it online!

\$\endgroup\$
17
\$\begingroup\$

R, score 13 14

F^F                       # F==0 in R
q=""=="";q--q             # ""=="" is TRUE, TRUE == 1 (Thanks WheatWizard)
3
4
5
6
7
8
9
1e1                       # scientific notation for 10
22/2
T+T+T+T+T+T+T+T+T+T+T+T   # T == 1
0xD                       
sum(mtcars$vs)            # mtcars is a built-in dataset, summing the $vs column gives 14

Got an extra one thanks to user2390246.

Characters used:

0123456789acemqrstuvxDFT^=";-/+()$

\$\endgroup\$
  • 1
    \$\begingroup\$ You can stretch to 14 if we're allowed to use built-in datasets. 1: F^F, 2: "n"%in%"n"+"n"%in%"n"; 3-9: numerals, 10: 1e1, 11: 22/2, 12: T--T--T--T..., 13: 0xD, 14: sum(mtcars$vs) \$\endgroup\$ – user2390246 Jun 6 '17 at 6:00
  • \$\begingroup\$ Brillant use of % and thinking of using built-in datasets. I can't see why it wouldn't be fine. \$\endgroup\$ – BLT Jun 6 '17 at 14:58
  • \$\begingroup\$ I did wonder whether it would be possible to get one more using built in data again: if there were a dataset with named rows and columns, you could have a command along the lines of dataset['A','B'], providing it avoided overlapping the letters already used (and happens to contain a useful value!). Unfortunately, as far as I can tell from a quick look, all of the datasets with named rows contain the letter i, so it's not compatible with using %in%. \$\endgroup\$ – user2390246 Jun 6 '17 at 15:35
  • \$\begingroup\$ Hmmm. For 2, you could use a trick from WheatWizard's Python answer: q=""=="";q+q. That would free up the use of the letters i and n. Don't have time to look into it now, but I bet there's an extra one in there somewhere... \$\endgroup\$ – user2390246 Jun 6 '17 at 15:52
  • \$\begingroup\$ I think you're right. The main trouble seems to be finding a dataset that doesn't use i,n,s,u,m,t,c,a,r,e,x, or v. Getting some letters back should help. \$\endgroup\$ – BLT Jun 6 '17 at 15:56
16
\$\begingroup\$

MATL, score 21 22 23 numbers (273 bytes)

Thanks to J Doe for extending from 22 to 23 numbers!

0~
'bd'd
{P}gk
HH^
5
6
7
8
9
3 3.333333333333333*
11
IEE
[B]Yq
llllllllllllllNwxwxwxwxwxwxwxwxwxwxwxwxwxwx
KUKUa-
4W
FFFFFFFFFFFFFFFFFn
TTTTTTTTTTTTTTTTTTs
rrrrrrrrrrrrrrrrrrrhhhhhhhhhhhhhhhhhhz
OOOOOOOOOOOOOOOOOOOOvZyX>
JJJJJJJJJJJJJJJJJJJJJ++++++++++++++++++++J/
22
`@QQQQQQQQQQQQQQQQQQQQQQ@@<

Try it online! Each snippet in the link is ended by either D (display) or ]D (close loop explicitly and display) to clear the stack and thus isolate from the next snippet.

Explanation

0~

Push 0. Negate. Gives true, which is displayed as 1.

'bd'd

Push string 'bd'. Consecutive difference between characters' code points.

{P}gk

Push cell array containing number pi. Convert to numeric array (i.e. to a single number). Round down.

HH^

Push 2 twice. Power.

5

Numeric literal.

6

Numeric literal.

7

Numeric literal.

8

Numeric literal.

9

Numeric literal.

3 3.333333333333333*

Push 3. Push 3.333333333333333. Multiply. Due to floating point accuracy this gives 10.

11

Numeric literal.

IEE

Push 3. Multiply by 2 twice.

[B]Yq

Push [6] (which is the same as 6). Compute n-th prime.

llllllllllllllNwxwxwxwxwxwxwxwxwxwxwxwxwxwx

Push 1 14 times. Number of elements in stack. Clear the rest of the stack.

KUKUa-

Push 4. Square. Do the same. Any: gives 1. Subtract.

4W

Push 4. 2 raised to that.

FFFFFFFFFFFFFFFFFn

Push array [false false ... false] (17 times). Number of elements in array.

TTTTTTTTTTTTTTTTTTs

Push array [true true ... true] (18 times). Sum of array.

rrrrrrrrrrrrrrrrrrrhhhhhhhhhhhhhhhhhhz

Push 19 random numbers taken from the interval (0,1). Concatenate horizontally 18 times. Number of nonzero elements in array.

OOOOOOOOOOOOOOOOOOOOvZyX>

Push 0 20 times. Concatenate stack contents vertically (gives a column vector). Size: gives the array [20 1]. Maximum of array.

JJJJJJJJJJJJJJJJJJJJJ++++++++++++++++++++J/

Push 1j (imaginary unit) 21 times. Add 20 times. Divide by 1j.

22

Numeric literal

`@QQQQQQQQQQQQQQQQQQQQQQ@@<

Do...while loop (`) with implicit end. In the first iteration it pushes the iteration index (@) and increments it (Q) 22 times, which yields 23. The loop condition (@@<) is false, so the loop is exited.

Some ideas for further improvement

  • (space) in snippet 10 could be replaced by |
  • X> in snippet 20 could be replaced by p, thus freeing prefix X.
  • Currently unused and potentially useful: :, A
\$\endgroup\$
  • \$\begingroup\$ Would you mind including the byte count? \$\endgroup\$ – Okx Jun 3 '17 at 16:18
  • \$\begingroup\$ @Okx Included now \$\endgroup\$ – Luis Mendo Jun 3 '17 at 16:22
15
\$\begingroup\$

Vim 8 on Windows, score 13, 104 bytes

1
2
3
4
5
6
7
^R=&ts^@
9
8^O^A^O^A
0^[^X^X^X^X^X^X^X^X^X^X^X0x
:h<CR>wwwwwwwwwwwy$:q<CR>p
grgKjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjYZZvPWWWllld|llD

^{keystroke} represents <C-{keystroke}>, so ^X is <C-x>, except for ^@ which is <C-j>. I am still trying to add more numbers to this list and <CR> represents a linefeed.

Note: to run these commands, start vim using -u NONE -U NONE. This is to ensure that your configs will not interfere with the code.

Snippets 1 through 10 start in insert mode. While snippets 12 and 13 starts in normal mode.

Explanations

Snippet 8 is :^R=&ts^@. I have to thank @L3viathan for coming up with this and @nmjcman101 for suggesting ^@ as a replacement for the linefeed and @ØrjanJohansen for shortening &tabstop to &ts. &ts then evaluates to the size of the tab, which is by default at 8, and this value is inserted into the editor.

Snippet 10 is 8^O^A^O^A. We insert an 8, and then increment it twice to get 10.

Snippet 11 is 0^[^X^X^X^X^X^X^X^X^X^X^X0x. We write down a 0 and decrement it 11 times to get -11. Then we remove the minus to get 11.

Snippet 12 is :h<CR>wwwwwwwwwwwy$:q<CR>p. This opens up Vim 8's help menu, which contains the following information:

*help.txt*  For Vim version 8.0.  Last change: 2016 Sep 12

And the sequence of ws move to the 12, at which point y$ copies the number. Then it is pasted into the editor using p.

Snippet 13 is grgKjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjYZZvPWWWllld|llD thanks to @DJMcMayhem for coming up with it. This works only on Windows. The snippet searches the help menu for commands starting with g. Then it moves down using j to get to this line:

|g?|        g?      2  Rot13 encoding operator

after which it copies it and pastes it in the buffer. After that, everything but the 13 is removed from the buffer.

\$\endgroup\$
  • \$\begingroup\$ Snippets are allowed. \$\endgroup\$ – Leaky Nun Jun 3 '17 at 14:01
  • \$\begingroup\$ Would ^R=&tabstop+&tabstop+&tabstop<CR>P give you the 12, or is <CR> already used because of ^M? \$\endgroup\$ – L3viathan Jun 3 '17 at 16:10
  • 1
    \$\begingroup\$ Yeah, I meant <CR> when I said ^M, but thanks, I will look into removing the ^M from snippet 8 now :) \$\endgroup\$ – Kritixi Lithos Jun 3 '17 at 16:12
  • 1
    \$\begingroup\$ @WheatWizard The control key does not count as a keystroke nor as a byte, but it is used in combination with other keys and these would be counted as bytes. For example, Ctrl+A gives the byte 0x01 while Ctrl+X gives 0x18. And clearly, these two are separate bytes. Does that make sense? \$\endgroup\$ – Kritixi Lithos Jun 5 '17 at 3:06
  • 1
    \$\begingroup\$ @L3viathan When starting vim with -u NONE -U NONE, &tabstop evaluates to 8. So I swapped this with the 8 snippet with some modifications, thanks :) \$\endgroup\$ – Kritixi Lithos Jun 5 '17 at 13:04
13
\$\begingroup\$

Mathematica, score 13

x~D~x
⌊E⌋
3
⌈Pi⌉
5
6
LucasL@4
8
9
0!+0!+0!+0!+0!+0!+0!+0!+0!+0!
77/7
Tr[{11,1}]
-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I
\$\endgroup\$
  • \$\begingroup\$ You should probably remove redundant space characters, it looks like you've reused that character otherwise. \$\endgroup\$ – Ørjan Johansen Jun 7 '17 at 20:25
  • 1
    \$\begingroup\$ that's not a problem. I will remove them. \$\endgroup\$ – J42161217 Jun 7 '17 at 20:27
  • 2
    \$\begingroup\$ "all characters must be encoded using a single byte in the language you choose" - I'm afraid that there isn't any encoding that encode the ⌊⌋⌈⌉ things in one byte each... \$\endgroup\$ – user202729 Nov 30 '17 at 13:20
  • \$\begingroup\$ We can avoid ⌊⌋⌈⌉ by turning ⌊E⌋ into Floor@GoldenRatio, ⌈Pi⌉ into 4, LucasL@4 into 7, and 77/7 into 22/2. It's probably possible to go at least one step further by applying a function with // \$\endgroup\$ – Misha Lavrov Nov 9 '18 at 22:40
12
\$\begingroup\$

05AB1E, Score 18, 67 bytes

X     Variable is initialized to 1
Y     Variable is initialized to 2
2>     2 + 1
4
5
6
7
8
9
T     Constant 10
3b     3 in binary
•C     Ascii code of 'C'
11Ì     11 in hex
A'ok     Index of 'o' in the alphabet
žz¨¤x+     Middle character of '256' times 2, plus itself
¾<<<<n     Variable initialized to 0, 4 times -1, squared
‘c‘‘c‘QDJH     'c' equals itself (true = 1), duplicated, converted from hex to dec
тD÷·±D*·     Constant 100, divided by itself, * 2, bitwise not, times itself, * 2
"d"aÐÐÐÐÐÐÐÐÐ)O     "d" is_alpha (true = 1), triplicated 9 times, total sum

Try it online!

\$\endgroup\$
  • 13
    \$\begingroup\$ Your answer is A'ok :) \$\endgroup\$ – Okx Jun 3 '17 at 15:38
  • \$\begingroup\$ Here are three more: „((Ç;¬ = 20.0 (two-byte char "(("; to ordinal values; halve both; take the tail); ₁.²₁P₃/ï = 21 (log-2 of 256; multiplied by 256; divided by 95; with decimals removed); ₂Ågttγć = 22 (26th Lucas term; two times square-rooted; split in chucks of equal elements; head extracted). The last two were trial and error.. ;) \$\endgroup\$ – Kevin Cruijssen Jun 1 '18 at 14:35
9
\$\begingroup\$

PingPong, score 127

In PingPong, every character has its own distinct numeric value, making counting all the way up to 127 a trivial task. The language works by reading in the value of every character and pushing it to the top of a stack, where all operations are performed. PingPong can theoretically go past 127 but it would require passing a block of characters that simply appear as spaces in a text editor so I left them out of my solution.

1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
10: A
11: B
12: C
13: D
14: E
15: F
16: G
17: H
18: I
19: J
20: K
21: L
22: M
23: N
24: O
25: P
26: Q
27: R
28: S
29: T
30: U
31: V
32: W
33: X
34: Y
35: Z
36: a
37: b
38: c
39: d
40: e
41: f
42: g
43: h
44: i
45: j
46: k
47: l
48: m
49: n
50: o
51: p
52: q
53: r
54: s
55: t
56: u
57: v
58: w
59: x
60: y
61: z
62: ©
63: ®
64: À
65: Á
66: Â
67: Ã
68: Ä
69: Å
70: Æ
71: Ç
72: È
73: É
74: Ê
75: Ë
76: Ì
77: Í
78: Î
79: Ï
80: Ð
81: Ñ
82: Ò
83: Ó
84: Ô
85: Õ
86: Ö
87: ×
88: Ø
89: Ù
90: Ú
91: Û
92: Ü
93: Ý
94: Þ
95: ß
96: à
97: á
98: â
99: ã
100: ä
101: å
102: æ
103: ç
104: è
105: é
106: ê
107: ë
108: ì
109: í
110: î
111: ï
112: ð
113: ñ
114: ò
115: ó
116: ô
117: õ
118: ö
119: ÷
120: ø
121: ù
122: ú
123: û
124: ü
125: ý
126: þ
127: ÿ
\$\endgroup\$
  • 5
    \$\begingroup\$ Ok, this isn't even fair... :P \$\endgroup\$ – MD XF Sep 21 '17 at 2:56
  • \$\begingroup\$ wow, it's like this language has been done for this challenge :D \$\endgroup\$ – V. Courtois Aug 7 at 6:50
  • \$\begingroup\$ TIL about another weird language :) \$\endgroup\$ – roblogic Aug 7 at 7:59
8
\$\begingroup\$

Octave, Score 14, 74 bytes

Pretty sure I'm close to the limit now.

1:  ~0                        % Not 0 == 1
2:  "H"/"$"                   % "H" = 72, "$" = 36. H/$ = 2
3:  3                         % Literal
4:  4                         % Literal
5:  5                         % Literal
6:  6                         % Literal
7:  7                         % Literal
8:  8                         % Literal
9:  9                         % Literal
10: ceil(pi*pi)               % pi*pi = 9.87. ceil(9.87) = 10
11: 11                        % Literal
12: 2+2+2+2+2+2               % Well, not much to say
13: ['','RT'-'!']             % 'RT' = [82,84]. Subtract '!' (33) to get ['',49,51]=13
14: nnz...                    % Number of non-zero elements in the string...
    nnnnnnnnnnnnnn            % on this line. (This is an awesome trick by the way!)

Had to remove strchr since I already have c in number 10. I still have j, ^, =, !, space and horizontal tab (ASCII-9) left, so it might be possible to squeeze one more in.

Horizontal tab can be used as a space, so the trick used with strchr and nnz can be used one more time. The only lower case letters left are abdfgjkmoquvwxy. There aren't many functions that can be made out of these. mod could work, but it can't take string input.

It's easy to use the remaining characters to get 1, but I don't know how I can get anything else.

Test all.

Possibly useful: fun a is the same as fun('a'), fun a b is the same as fun('a','b') and so on. This can be used several places:

gt t g    % Equivalent to 't'>'g'. Returns 1. Uses space (available)
or o r    % Equivalent to 'o' | 'r'. Returns 1. 

Using this will make 0 available, but I can't see how to make it useful yet.

e (2.71828...) and j are still unused. Must remove ceil to use e though.

Alternatives (inspiration):

1:  ~0             % Not 0 = 1
2:  2              % Numeral
3:  3              % Numeral
4:  fix(i^i^i^i)   % Numeral
5:  5              % Numeral
6:  6              % Numeral
7:  7              % Numeral
8:  8              % Numeral
9:  9              % Numeral 
10: 1+1+1+1+1+1+1+1+1+1   % Well, not much to explain
11: ['','RR'-'!']  % RR are [82,82] in ASCII, subtract 33 (!) to get
                   % [49,49], and concatenate with the empty string to convert [49,49] to 11 
12: nnz nnnnnnnnnnnn   % Number of non-zero elements in the string containing 12 n
13: "4"/4          % "4" = 52. Divide it by 4 to get 13.
\$\endgroup\$
7
\$\begingroup\$

JavaScript (ES7), 16 integers, 137 130 128 bytes

I took @ETHproductions' answer and ran with it for a while; it's changed so much that I'm posting it separately. Ideas are welcome. :)

""**""
-~-~{}
3
C=CSS==CSS;C<<C<<C
5
6
7
8
9
++[[]][+[]]+[+[]]
11
4444444444444444444%44
222>>2>>2
`..............i`.indexOf`i`
0XF
atob('MTY')

Remaining:
$_@#!^&|/?:, ABDEGHIJKLNPQRUVWZcghjklmpqrsuvwyz

Or, if the snippet for 1 is replaced with !!/!//!!/!/:
$_@#^&|*?:", ABDEGHIJKLNPQRUVWZcghjklmpqrsuvwyz


JavaScript (ES7), 16 integers, 127 bytes

One byte shorter. :P

""**""
-~-~{}
3
4
5
6
7
C=CSS==CSS;C<<C<<C<<C
9
++[[]][+[]]+[+[]]
11
`............i`.indexOf`i`
222>>2>>2
0XE
atob('MTU')
88888888888888888%88

Remaining: $_@#!/^&|?:,ABDFGHIJKLNPQRVWYZcghjklmpqrsuvwyz

\$\endgroup\$
  • 1
    \$\begingroup\$ Save 7 bytes on 2 with -~{}-~{} :P Overall, though, these are pretty good. Way shorter than mine for sure... \$\endgroup\$ – ETHproductions Jun 4 '17 at 2:14
  • 1
    \$\begingroup\$ And you still have all of !&/^| left to work with, pretty impressive. If need be, you can use !!/!//!!/!/ for 1 to trade !/ for "*. \$\endgroup\$ – ETHproductions Jun 4 '17 at 2:22
  • \$\begingroup\$ @ETHproductions Awesome! \$\endgroup\$ – darrylyeo Jun 4 '17 at 2:38
  • 1
    \$\begingroup\$ 2 is just -~-~{} \$\endgroup\$ – GOTO 0 Jun 4 '17 at 8:49
  • \$\begingroup\$ 10 can be written as +!![]+[+[]], as long as there is no better use for ! \$\endgroup\$ – GOTO 0 Jun 4 '17 at 8:59
7
\$\begingroup\$

Dyalog APL, score 15, 89 bytes

≡''
≢###
3
4
⍴⍬⍬⍬⍬⍬
6
⌈○2
8
9
1E1
⎕D⍳⊂⎕D











l:l
7--7-×7
(~0 0 0 0 0 0 0 0 0 0 0 0 0 0)⊥~0
5+5+5

The newlines before l:l are part of 12.

The spaces in 14 represents tabs.

\$\endgroup\$
  • 1
    \$\begingroup\$ I think you may be using space in both 12 and 14. Can APL use tabs instead? \$\endgroup\$ – Ørjan Johansen Jun 6 '17 at 20:49
  • \$\begingroup\$ @ØrjanJohansen there is no extra space, but I did included mistakenly the lines seperating the snippets \$\endgroup\$ – Uriel Jun 6 '17 at 20:53
  • \$\begingroup\$ I mean, the space character seems to be used in two entries, 12 and 14. \$\endgroup\$ – Ørjan Johansen Jun 6 '17 at 22:33
  • \$\begingroup\$ @ØrjanJohansen oh, yes, the last one would go with tabs. \$\endgroup\$ – Uriel Jun 6 '17 at 22:57
  • \$\begingroup\$ @Uriel some ideas: 0 0 0 -> 0,0,0; ]fromhex f \$\endgroup\$ – ngn Jan 22 '18 at 20:08
7
\$\begingroup\$

><>, score 20, 93 90 74 65 bytes

(3 bytes saved by Teal Pelican, lots of bytes saved by Jo King!)

iii((
2
3
ll{lll{[
5
6
7
8
!   00=0g
a
b
c
d
e
f
44*
'RA'%
999-9--
"&F#",,
1::+:++:+:+

Try them at the fish playground! You can make the snippets print their results by adding n; to the end of each. Note that the 9th snippet contains a tab, which is eaten by stack exchange.

Explanation:

  • In iii((, each i tries to get input, but since there isn't any, they push EOF = -1 instead. Then ( is the less-than instruction, and since -1 is not less than -1, it pushes a falsey 0; but the second ( asks if -1 is less than 0, which it is, so it pushes a truthy 1.
  • 2 and 3 are obvious.
  • For ll{lll{[, the first l pushes the length of the stack, which is 0, then the second pushes the new length, bringing the stack to 0, 1. The { rotates the stack left, swapping the 1 and 0. Three more ls bring the stack to 1, 0, 2, 3, 4. Then { rotates the 1 to the front, and [ siphons off the first 1 thing on the stack, which is 4.
  • 5, 6, 7 and 8 are obvious too.
  • In !\t00=0g (where \t represents a tab), ! skips the tab, then 00= pushes two zeros and checks if they're equal — they are, so we get a truthy 1. After pushing another 0, the g gets the character in position 1,0 of the code, which is the tab with character code 9.
  • a through to f each push 10 to 15 respectively (presumably to make hexadecimal nice).
  • 44* pushes two 4s and multiplies them together, for 16.
  • 'RA' pushes the character codes of R and A (82 and 65 respectively) to the stack, then % computes 82 mod 65 = 17.
  • 999-9-- evaluates to 9 - ((9 - 9) - 9) = 18.
  • "&F#" pushes the character codes of &, F and #, which are 38, 70 and 35 respectively. Then , is division, so we get 38 / (70 / 35) = 19.
  • Finally, 1:: pushes a 1 and duplicates it twice, + adds two of the ones together to get 2; :+ duplicates the 2 and adds it to itself to get 4; + adds the leftover 1 to get 5; then :+:+ duplicates and adds twice, resulting in 20.

This is the maximum score possible with ><>. Any snippet must include an instruction somewhere that turns an empty stack into a non-empty stack, and there are only 18 ><> instructions that can do that (namely i, l, and the digits 0–9 and a–f), plus string mode. (Every other instruction either does nothing to an empty stack, ><v^/\|_#x!{}r, or tries to pop something and errors, ?.+-*,%=():~$@[]on&gp.) Entering string mode uses either " or ', so there are at most 18 + 2 = 20 snippets possible.


If you're more comfortable with unprintables than I am, this is possible in 53 bytes, thanks to Jo King: 00=, iii((i-, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, 2222***, !Xll$g, 11+::+:+:++, 'Y', "Z", where the X, Y and Z are replaced by characters with codes 17, 19 and 20 respectively.

\$\endgroup\$
  • 1
    \$\begingroup\$ This is great, I've been looking at this problem and wasn't able to do anywhere near this well but I studied yours and was able to golf it a little bit; 16 can be changed to be; iii((:i$--:i$--:i$--i- and 1 to be changed to be; 00= and you reduce both lines by a couple bytes. \$\endgroup\$ – Teal pelican Jun 7 '17 at 14:50
  • \$\begingroup\$ @Tealpelican, nice work, thank you! \$\endgroup\$ – Not a tree Jun 9 '17 at 5:10
  • 1
    \$\begingroup\$ -23 bytes by changing the following 2 > iii((i- 16 > 2222*** 17 > lll{lllll{{[{n (maybe sketchy, but if you want to output as one number, at least there's one less l) 18 > 11+::+:+:++ \$\endgroup\$ – Jo King Dec 30 '17 at 14:38
  • \$\begingroup\$ @JoKing, wow, that's a big golf! (I went with the less sketchy version of 17 — it seemed more in keeping with the rules.) \$\endgroup\$ – Not a tree Dec 30 '17 at 20:41
  • 1
    \$\begingroup\$ How about 17 => ! ll$g where the space is replaced by the control character with value 17 (Device Control 1)? \$\endgroup\$ – Jo King Jan 21 '18 at 7:06
7
\$\begingroup\$

MathGolf, 48 51 53 integers, 324 bytes

î
ª∞~
c±b±+
φⁿ_¥-
5
6
7
○¢i♀/
d²
♂
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
♫¼¼¼¼
88888]Σ
41
╔½½½½½½½½½½½
π░3§3
22#22#
τ╥└
♦⌡⌡⌡⌡⌡⌡⌡⌡⌡
!⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠
'0$
ÿ@@@@£9
))))))))))))))))))))))))))))))))))))))))))))))))))
►◄╠•╠
"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"h 
♣(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

+2 score (and -2 distinct bytes used for 40) thanks to @maxb.

Each line is a separated program.

Used bytes (92 distinct bytes): îª∞~c±b+φⁿ_¥-567○¢i♀/d²♂ABCDE☻FGHIJKLMNOPQRST♥UVWXYZ♫¼8]Σ41╔½π░3§2#τ╥└♦⌡!⌠'0$ÿ@£9)►◄╠•╠"h ♣(

Explanation and TIO-links:

MathGolf is a new golfing language specialized in mathematical golfing challenges. It has loads of single-byte builtins for numbers, making this a perfect challenge for it.

1) î: Push the 1-indexed value of the loop, which is 1 by default: Try it online.
2) ª∞~: Push [1]; double it ([2]); pop list and push its content onto the stack: Try it online.
3) c±b±+: Push -2; then pop and push its absolute value; push -1; then pop and push its absolute value; and add them together Try it online.
4) φⁿ_¥-: Push the golden ratio (1.618033988749895); cube it (4.23606797749979); duplicate the top of the stack; take modulo 2 (0.23606797749979); subtract them from each other: Try it online.
5,6,7) The numbers themselves: Try it online.
8) ○¢i♀/: Push 2048; convert to a hexadecimal string (800); cast to integer; push 100; divide: Try it online.
9) : Push -3; squared: Try it online. 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38) Push builtins for the numbers themselves (♂ABCDE☻FGHIJKLMNOPQRST♥UVWXYZ): Try it online.
39) ♫¼¼¼¼: Push 10000; integer-divided by 4 four times: Try it online.
40) 88888]Σ: Push 8 five times; wrap them into a list; sum that list: Try it online.
41) The number itself: Try it online.
42) ╔½½½½½½½½½½½: Push 86400; integer-divided by 2 eleven times: Try it online.
43) π░3§3: Push PI (3.141592653589793); cast to string; pop and push its third 0-indexed character (4); push 3; output the entire stack joined together implicitly: Try it online.
44) 22#22#: Push 2 two times; take the power of the two (4); do it again; output the entire stack joined together implicitly: Try it online.
45) τ╥└: Push 2*PI (6.283185307179586); pop and push the power of 2 below it that's closest (4); push the top of the stack + 1 without popping (5); output the entire stack joined together implicitly: Try it online.
46) ♦⌡⌡⌡⌡⌡⌡⌡⌡⌡: Push 64; decrement by 2 nine times: Try it online.
47) !⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠⌠: Push gamma(n+1) (1 by default); increment by 2 twenty-three times: Try it online.
48) '0$: Push ordinal value of character '0': Try it online.
49) ÿ@@@@£9: Push string "@@@@"; pop and push its length (4); push 9; output the entire stack joined together implicitly: Try it online.
50) )))))))))))))))))))))))))))))))))))))))))))))))))): Increment by 1 fifty times: Try it online.
51) ►◄╠•╠: Push 1,000,000; Push 10,000,000; pop both and integer-divide them with each other (10); push 512; pop both and integer-divide them with each other: Try it online.
52) "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"h : Push string "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"; push its length (without popping the string); remove everything from the stack except for the last item: Try it online.
53) ♣(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((: Push 128; decremented by 1 seventy-five times: Try it online.

Will try to add some more later on. I still have some useful things left, including modulo % and multiply *.

\$\endgroup\$
  • \$\begingroup\$ I was working on a solution for this, but I got stuck trying to optimize the 1-9. Once you get to 10 it becomes trivial to reach 38. A few things that I notice at a first glance: 88888ΓΣαΣ -> 88888]Σ or 88888§§§§Σ saves you 2 commands at the cost of using one. You could also do something like "xxxxxx"h  where the last character is a non-breaking space which clears everything but TOS and you can use the length of the string to generate the number. Perhaps use something other than x though, because then you've got Wx which gives you 53 as long as you can get 35 another way. \$\endgroup\$ – maxb Nov 27 '18 at 10:10
  • \$\begingroup\$ Also, I have just added a char/ord operator, which works like 'A$ -> 67, and also works for longer strings (kind of like base-256 integers). It's not extremely well documented, but if you're interested in improving this answer, I could recreate the chat room for MathGolf for any questions. \$\endgroup\$ – maxb Nov 27 '18 at 10:13
  • \$\begingroup\$ @maxb I saw your comment when I was sick in bed, but I now have some times to improve this answer. Thanks for the 88888]Σ. Didn't knew about ]. As for the "hhhhh"h , that doesn't seem to work. :S \$\endgroup\$ – Kevin Cruijssen Dec 4 '18 at 12:00
  • 1
    \$\begingroup\$ I don't know if it's able to be pasted directly from here, but the code should end with NBSP, the non-breaking space character. That command clears everything but the top of the stack. I'm fairly sure that PPCG converts the character to a regular space here in the comments. Try this \$\endgroup\$ – maxb Dec 4 '18 at 12:05
  • \$\begingroup\$ When it comes to arrays, I define them recursively in MathGolf, with [ starting the array context and ] ending it and wrapping the results in an array. To have the top level behave like the lower levels, having ] wrap the entire stack in an array seemed like a good idea. \$\endgroup\$ – maxb Dec 4 '18 at 12:09
6
\$\begingroup\$

Java 8, 11 12 13, 39 bytes

Java only has 10 symbols for numbers (0-9) and all method calls and constants require a period, so I'm not sure I can get above 11 outputs

Apparently chars cast to integers by default when operations are applied

+1 with the help of @OlivierGrégoire

i->-~i
2
3
4
5
6
7
8
9
'P'^'Z'
11
"::::::::::::"::length
0xD

Explanations:

i->-~i

integer lambda which takes no input and returns 1. When a parameter takes no input the default value is used as per the above meta post, which for integers is 0

2
3
4
5
6
7
8
9

literal integers

'P'^'Z'

XOR of two characters to return 10

11

literal integer

":::::::::::"::length

lambda expression which returns the length of a 12 character string

0xD

Hexadecimal 13

TIO Link if you want to verify.

\$\endgroup\$
  • 1
    \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Dennis Jun 7 '17 at 1:30
  • \$\begingroup\$ To shorten the byte count (-6 chars), 2 can be written as 2 and 10 as 'P'^'Z'. Also, this frees the characters X+* and uses P. \$\endgroup\$ – Olivier Grégoire Jun 7 '17 at 11:43
  • \$\begingroup\$ We require lambda parameters to have types in Java, so i->i.ONE is invalid. \$\endgroup\$ – Nathan Merrill Jun 7 '17 at 13:53
  • \$\begingroup\$ This more upvoted answer disagrees with you. \$\endgroup\$ – Olivier Grégoire Jun 7 '17 at 14:59
  • \$\begingroup\$ Also, this is the first time I see this "requirement" in a year on this website and no one ever disagreed with any of my golfs when such lambdas are used. \$\endgroup\$ – Olivier Grégoire Jun 7 '17 at 15:06
6
\$\begingroup\$

Gaia, score 25, 203 bytes

§‼
..⌉+⌉
₵P~~
4
5
6
∂Ql
8
9
¶c
11
'¡ċ⌋u⌋
--⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻
7:,Σ
Ø!))))))))))))))
øøw<øøw<«øøw<«øøw<«øøw<«
⟩‘
₸ḣ₸K$₸ḣ₸/S₸₸/=$
]]]]]]]]]]]]]]]]]]]n
⇑’e
0(((((((((((((((((((((_
22
“B”“↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺B”B
3₈×
ℍḥḥ

I consider this a perfect score, as no more nilads can be used given the character limitations.

Explanations

1. §‼

§ is a space character, is coerce to boolean, so the result is 1.

2. ..⌉+⌉

. is a shortcut for 0.5, so this is ceil(0.5+ceil(0.5)).

3. ₵P~~

₵P is pi, ~ is bitwise negation. Double bitwise negation is simply truncation.

4. 4

5. 5

6. 6

7. ∂Ql

∂Q is a list containing the names of the days of the week, l is length.

8. 8

9. 9

10. ¶c

Code point c of linefeed .

11. 11

12. '¡ċ⌋u⌋

'¡  The string "¡"
ċ   Turn it into a list of code points: [161]
⌋   Minimum: 161
u⌋  Floored square root: 12

13. --⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻-⁻

- is a shorthand for -1, is subtraction. So this is -1 - -1 - -1... enough times to make 13.

14. 7:,Σ

Push 7, duplicate :, pair , the two 7s into a list, and sum Σ.

15. Ø!))))))))))))))

Ø is an empty string, so Ø! is 1. Increment ) 1 14 times.

16. øøw<øøw<«øøw<«øøw<«øøw<«

øø    Push two empty lists
w     Wrap one of them
<     [] < [[]]? (it is, so push 1)
øøw<  Do the same thing again to push another 1
«     Bitshift 1 left by 1
      Do that same thing again 3 more times to get 16

17. ⟩‘

Closing a string with makes it a base-250 number literal. is at byte value 17 in Gaia's code page.

18. ₸ḣ₸K$₸ḣ₸/S₸₸/=$

₸     10
ḣ     doubled
₸     10
K     20 choose 10 (184756)
$     Digit list
₸ḣ₸/  20/10 (2)
S     Split the digit list at index 2 ([[1 8][4 7 5 6]])
₸₸/   10/10 (1)
=     Get the first element of that split ([1 8])
$     Join together and print 18

19. ]]]]]]]]]]]]]]]]]]]n

Each ] wraps the stack in list. Do this 19 times and get the depth n of the list.

20. ⇑’e

Closing a string with makes it a list of codepage code points. e dumps the list on the stack. has a code point of 20 in the codepage.

21. 0(((((((((((((((((((((_

Decrement ( 0 21 times, then negate _.

22. 22

23. “B”“↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺B”B

Convert the string “B” from base-24, where the digits from 0-23 are ↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺↺B. The result is 23.

24. 3₈×

3 × 8.

25. ℍḥḥ

100 halved , and halved again.

\$\endgroup\$
5
\$\begingroup\$

C, score 13

These are just a bunch of integer constants.

0==0
__LINE__
3
4
5
6
7
8
9
1+1+1+1+1+1+1+1+1+1
'o'/'.' 
2*2*2*2-2-2
strlen("strlenstrlens")
  1. 0==0 evaluates to 1
  2. Assumes code is on line 2. __LINE__ = 2
  3. Integer constant
  4. Integer constant
  5. Integer constant
  6. Integer constant
  7. Integer constant
  8. Integer constant
  9. Integer constant
  10. 1+1+1... = 1*10 = 10
  11. 'o' is 111, '.' represents the unprintable ASCII 0x10. 111/10 = 11
  12. (2<<2) = 8, 8*2 = 16, 16-2-2 = 12
  13. string length of "strlenstrlens" = 13
\$\endgroup\$
5
\$\begingroup\$

Ohm, score 21 22, 160 total bytes

╓S@Ri
ΓΓ-Γ-Γ-
αê⌠
¡¡¡¡¼
5
▀lll▀l
ÑÑÑÑÑÑÑÿWÿk
ü`½½
9
..≥°
$$J
3dd
7ƒ
2≡≡≡Σ
║F
4º
0ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~
6DD++
8π
τ╛hτ*
"≤"≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤A
1111 11v11%L1111 11v11%L

Try it online!

Explanations

1. ╓S@Ri

Push the seconds of the current date/time (╓S). Get the inclusive range from 1 to seconds (@), reverse it (R), get the last element (i), which is always 1.

2. ΓΓ-Γ-Γ-

Γ is -1, so this is (-1) - (-1) - (-1) - (-1), which is 2.

3. αê⌠

αê is Euler's number (2.71828...), is ceiling. 3 is the result.

4. ¡¡¡¡¼

¡ increments the counter, ¼ pushes the counter.

5. 5

Just a literal.

6. ▀lll▀l

▀lll▀ is a compressed string literal which is equivalent to "of >ic". l takes the length, so the result is 6.

7. ÑÑÑÑÑÑÑÿWÿk

First we push 7 newline chars (Ñ) and then an empty string (ÿ). The stack is wrapped in an array (W), and then the index of the empty string in that array is found.

8. ü`½½

ü is a space character. ` pushes its ASCII value (32), then it gets halved twice (½½).

9. 9

Just a literal.

10. ..≥°

.. is a literal . character. It gets incremented (), which parses the string as a number, defaulting to 0 since it's not a valid number, and increments it to 1. Then we compute 101 (°).

11. $$J

$ pushes the current value of the register, initially 1. So, push 1 twice, join the stack together and print.

12. 3dd

Push 3 and double it twice.

13.

Pushes the 7th Fibonacci number.

14. 2≡≡≡Σ

Push 2, triplicate it three times, leaving 7 2's on the stack. Then take the sum of the stack (Σ).

15. ║F

is the delimiter for base-220 number literals. Since this is at the end of a line, it doesn't need to be terminated.

16.

Compute 24.

17. 0ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~ò~

ò is bitwise negate, ~ is arithmetic negate. Combining these operators, we can increment 0 17 times.

18. 6DD++

Push 6, duplicate it twice, and compute 6+6+6.

19.

Push the 8th prime number.

20. τ╛hτ*

Push 10 (τ), get the first element (h) of its prime factors (), multiply that by 10.

21. "≤"≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤≤A

Similarly to previous snippets, the string "≤" gets parsed as 0. We decrement it 21 times, then take the absolute value.

22. 1111 11v11%L1111 11v11%L

Here we compute 1111 div 11 mod 11, which is 2, then print 2. Then do it again.

\$\endgroup\$
5
\$\begingroup\$

PowerShell, score 12, 91 bytes. 14, 176 bytes

[byte]!![byte]                    # type gets cast to bool false, inverted, to int = 1
-   -$?-shl$?                   # -bool true is -1, shift left, negative. (Tab not space)
3
4
5
6
7
8
9
1+1+1+1+1+1+1+1+1+1
22/2                                           # use the 2
'uuuuuuuuuuuu'.LENGTH                          # string length
0xd
@{z=@{};Y=@{};YY=@{};w=@{};v=@{};U=@{};zz=@{};S=@{};r=@{};q=@{};p=@{};J=@{};K=@{};m=@{}}|% COU*             # count items in hashtable (space)

Edit:

  • Thanks to Ørjan Johansen for suggesting the hex literal 0xd for 13 and the rearranging of 5 to free up 1+1+1+1.. as an option.
  • Changed array length to string length, [int] to [byte] and hashtable to use hashtables as values, freeing up (),"" Pondering 15 with something like "ZZZZZZZZZZZZZZZA".InDeXof("A") but can't reuse the dot or the 'e'..

PowerShell can't do variables without $, can't do exponentiation, bit shifting, Pi, ceil(), etc. with basic symbols, and mostly does type coercian to/from bool and to/from numbers-as-strings, so there's relatively little scope for low-syntax number generation.

\$\endgroup\$
  • \$\begingroup\$ You haven't used 0 yet, so 13 can be 0xd. You can put 5 in its normal place, freeing up + for combining 1s. That should get you to 14. If you need to save characters the hashtable keys can be more than one letter. And if you have some spare way of getting 1s to sum, you can do 10 = 1e1. \$\endgroup\$ – Ørjan Johansen Jun 12 '17 at 0:41
  • \$\begingroup\$ @ØrjanJohansen - good ideas, thanks, edited my answer with them \$\endgroup\$ – TessellatingHeckler Jun 12 '17 at 2:02
  • \$\begingroup\$ I found a different way of doing 2: ""-(""-(""-lt(""-""))-(""-lt(""-""))). That frees up $? for summing, and then you can do the 1e1 thing I suggested. \$\endgroup\$ – Ørjan Johansen Jun 12 '17 at 3:11
  • \$\begingroup\$ Um wait the t clashes with both versions of 1. (""-eq"")-(""-(""-eq"")) seems better, the q in the hashtable is easily replaced. \$\endgroup\$ – Ørjan Johansen Jun 12 '17 at 3:21
5
\$\begingroup\$

TI-Basic (83 series), score 21 22 23 24 25 (1003 bytes)

1:  A=A
2:  int(tan(tan(cos(cos(cos(B
3:  tanh⁻¹(√(√(√(√(√(√(√(√(√(√(C!°√(√(C!°
        √(√(√(√(√(√(C!°√(√(√(√(√(√(C!°√(
        C!°√(√(√(C!°√(C!°√(C!°√(√(√(√(√(
        √(C!°√(C!°√(C!°√(C!°
4:  4
5:  cosh(sinh⁻¹(cosh(sinh⁻¹(...sinh⁻¹(cosh(D    with 25 repetitions of cosh(
6:  6
7:  7
8:  8
9:  9
10: ₁₀^(₁₀^(E
11: 11
12: F nPr F/sin(tan⁻¹(...(sin(tan⁻¹(F nPr F     with 143 repetitions of sin(tan⁻¹(
13: det([[G≤G]...[G≤G]]ᵀ[[G≤G]...[G≤G           with 26 repetitions of G≤G
14: ln(tanh(not(H))...tanh(not(H)))
        ln(tanh(not(H)))^⁻not(H                 with 14+1 repetitions of tanh(not(H))
15: iPart(e^(e^(e^(I
16: sum(dim(identity(sum(dim(identity(sum(
        dim(identity(sum(dim(identity(J≥J
17: K nCr K+K nCr K+...+K nCr K                 with 17 repetitions of K nCr K
18: abs(i-i-...-i                               with 20 repetitions of i
19: rand→L:log(LL...LL→M:log(L→N:N⁻¹M           with 19 L's inside the log
20: mean(seq(OOO,O,O,sinh(sinh(cos⁻¹(O
21: ππ³√(π³√(ππ³√(ππ³√(ππ³√(π³√(³√(ππ³√(π³
        √(π³√(ππ³√(π³√(ππ³√(ππ³√(ππ³√(π³√(
        π³√(³√(ππ³√(ππ
22: 22
23: 3(3(3×√(3(3(3×√(3(3×√(3(3(3×√(3×√(3×√(
        3(3×√(3(3×√(3(3(3×√(3(3×√(3×√(3(3(
        3×√(3(3×√(3×√(3×√(3(3(3×√(3(3×√(3(
        3(3×√(3×√(3(3(3×√3
24: Fix 0
    sin⁻¹(ᴇ0
    AnsAnsAnsAnsAnsAnsAns
25: 5*5

Refer to http://tibasicdev.wikidot.com/one-byte-tokens for a list of which things the challenge does and does not allow here.

All of these can be complete programs, since the last line of a program gets printed automatically. But (except for 17, which is multiple lines long) they can also be snippets on the home screen.

At this point, I see no other way to get any nonzero value out of the remaining tokens available. If there's any improvement to be made, it will have to involve first making some of the solutions above more conservative.

Explanations

  • A=A is a boolean 1 because the variable A is equal to itself.
  • B is 0 by default, tan(tan(cos(cos(cos(B is about 2.21, and then we take the floor.
  • C!° is 1 degree in radians, about 0.017. Some positive power of this is tanh(2), about 0.964. We encode that power in binary using implied multiplication and √(, and then take tanh⁻¹(.
  • 4 is straightforward
  • cosh(sinh⁻¹(X simplifies to \$\sqrt{1+X^2}\$, and used 25 times it gives us 5.
  • 6-9 are straightforward
  • ₁₀^( is a one-byte built-in for powers of 10, and 10^10^0 = 10^1 = 10.
  • 11 is 11.
  • Another instance of the trick used on 5. F nPr F is 1. sin(tan⁻¹(X simplifies to \$\frac{1}{\sqrt{1+1/X^2}}\$, and used 143 times starting with 1 it gives us 1/12. Dividing 1 by this number is 12.
  • G≤G is 1, so [[G≤G]...[G≤G]] is a 13x1 column vector. Taking the product of its transpose with itself gives the matrix [[13]], whose determinant is 13.
  • not(H) is 1. tanh(not(H)) is just some number not equal to 0 or 1, and ln(XXX....X)ln(X)^⁻1 will simplify to the number of X's in the first log provided that X is not 0 (so that the log exists) and not 1 (so that we're not dividing by 0).
  • e^(e^(e^(F evaluates to about 15.15, and then we take the floor.
  • J≥J is 1. identity( constructs a 1x1 identity matrix, dim( finds its row and column dimensions, and sum( adds them to get 2. Then we do this again, adding the dimensions of a 2x2 matrix to get 4, and again, adding the dimensions of a 4x4 matrix to get 8, and again, adding the dimensions of a 8x8 matrix to get 16.
  • K nCr K is the binomial coefficient 0 choose 0, or 1. Adding together 17 1's gives 17.
  • i-i-...-i simplifies to ⁻18i, and taking abs( gives 18.
  • rand→L stores a random real number to L, but we don't care what it is. We are computing log(L)⁻¹log(L^19), which simplifies to 19.
  • sinh(sinh(cos⁻¹(I is a bit over 4, so seq(III,I,I,sinh(sinh(cos⁻¹(I gives the list {0 1 8 27 64} whose arithmetic mean is 20.
  • Another instance of the trick used to get 3. Here, some power of π should give 21; we encode that power in ternary using implied multiplication and ³√(.
  • 22 is 22.
  • Another instance of the trick used to get 3 and 21. We encode the power of 3 that equals 23 in ternary, using 3×√( as cube root and ( for multiplication.
  • Fix 0 is the setting for displaying 0 digits after the decimal, rounding all values to integers. sin⁻¹(ᴇ0 evaluates to π/2, and π/2 multiplied by itself 7 times gives about 23.59, which rounds to 24.
  • 5*5 is 25. (It would be more conservative to use 5 to get 5, and adapt the solution used there for 25. But this way saves lots of space, and * isn't a very useful character because implied multiplication exists.)
\$\endgroup\$
  • \$\begingroup\$ Xmax is 10 by default, same with Ymax=10, Ymin=Xmin=-10 and some other default values. \$\endgroup\$ – lirtosiast Nov 11 '18 at 1:37
  • \$\begingroup\$ @lirtosiast All of these are two bytes. \$\endgroup\$ – Misha Lavrov Nov 11 '18 at 1:41
  • \$\begingroup\$ I'm not sure about the interpretation of the rules, but I think you can still use one of them without repeating any bytes (considering characters as bytes rather than tokens) \$\endgroup\$ – lirtosiast Nov 11 '18 at 1:48
  • \$\begingroup\$ I'm vaguely skeptical about that interpretation. In any case, counting characters as bytes, it would have to be something like Xfact=4, since Xmax conflicts with °. We'd probably be able to get one point out of that, another point out of the 2-byte commands, and a third point out of the TI-84-only commands. \$\endgroup\$ – Misha Lavrov Nov 11 '18 at 1:51
4
\$\begingroup\$

SOGL, score 16 18 20, 109 bytes, 47 characters used

=                    push ""=""
ρ:¾/U                ceil(isPalindrome("")/(isPalindrome("")*(3/4))) -> ceil(1/(3/4)) -> ceil(4/3)
3                    push 3
MM¼÷                 100/(100*1/4)
æ⁄                   length of "aeiou"
6                    push 6
7                    push 7
Nτ                   log2(256)
9                    push 9
L                    push 10
⁹’                   byte with the 11th SOGL code point
Ιζrkk"⁸              `⁸`s UTF-8 codepoint to string, take off 1st 2 chars
'⁰                   messy compression
īuHHHHHHHHHHHHHH±    floor(0.1) `-1` 14 times, then change sign
aIIIIIIIIIIIIIII     A `+1` 15 times, A = 0
4²                   4^2
lllllllllllllllll”l  length of "lllllllllllllllll"
222222222++++++++    2+2+2+2+2+2+2+2+2
δ“○“-                429-420
Μ℮‘                  compressed string of "2ŗ" where ŗ defaults to 0
\$\endgroup\$
4
\$\begingroup\$

Brachylog, 16 integers, 86 bytes

1
2
3
4
5
6
7
8
9
ℕ<<<<<<<<<<
≜+₁₁
Ịbkkkkkkkị
Ḥl
ℤ₇×₂ṅ
"____**"pᶜ¹
⟦h>>>>>>>>>>>>>>>>ȧ

Try it online! (The input controls which program is ran, from 1 to N)

Explanation

                       The output is...

1                      1
2                      2
3                      3
4                      4
5                      5
6                      6
7                      7
8                      8
9                      9
ℕ<<<<<<<<<<            Strictly bigger than ... strictly bigger than 0
≜+₁₁                   0 + 11
Ịbkkkkkkkị             "12" converted to an integer
Ḥl                     The length of "Hello, World!"
ℤ₇×₂ṅ                  -(-7 × 2)
"____**"pᶜ¹            The number of unique permutations of "____**"
⟦h>>>>>>>>>>>>>>>>ȧ    The absolute value of stricly less than ... stricly less than 0
\$\endgroup\$
  • 1
    \$\begingroup\$ Just thought about Prolog: 1, since you always need a dot at the end. \$\endgroup\$ – false Jun 5 '17 at 23:00
4
\$\begingroup\$

Jelly, score 22, 177 bytes

1: Ṇ  : logical NOT. When there is no input, 0 is assumed, so this returns NOT(0)=1
2: ~A~A  : ~ is bitwise NOT and A is absolute value, implicit 0 input
         : 0~ = -1;   0~A = 1;   0~A~ = -2;  0~A~A = 2.
3: 3  : literal 3
4: -ı-²²×-Ḟ:
   -ı-     : literal complex number -1-1j
   ²²×-    : square (2j), then square(-4), then multiply by (×) negative 1 (-) to get 4+0i
   Ḟ       : get the real component, which is 4
5: 5  : literal 5
6: 6  : literal 6
7: 7  : literal 7
8: 8  : literal 8
9: ØDṪ : tail(Ṫ) of list of digits (ØD) to return 9
10: ⁵  : literal 10
11: 11 : literal 11
12: CNCNCNCNCNCNCNCNCNCNCNC : again, 0 is taken as input because there is no input
                            : C is complement and N is negate
                            : so each NC returns 1-(-n)=n+1 and is equivalent to increment, returning 12
13: “>>>>>»L    : encodes "#GlomAbducens" with “>>>>>» then returns the length in characters (13) with L
14: ‘‘‘‘‘‘‘‘‘‘‘‘‘‘   : default input is 0 again, and each ‘ increments it to get 14
15: Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;Ị;ỊS : default input is 0 again.
                                   : each Ị returns abs(0)<1 = 1
                                   : these are concatenated together with ; then summed with S to get 15
16: ⁴  : builtin literal 16
17: ,,,,,,,,,,,,,,,,,ŒḂŒḊ : Each , is the pair dyad: x,y = [x,y] and x,[y,z] = [x,[y,z]]. 
                          : Thus each , increased the depth by 1, then ŒḊ returns the depth: 17
18: 9Ḥ : 9 doubled = 18
19: E+E+E+E+E+E+E+E+E+E+E+E+E+E+E+E+E+E+E : each E returns areallelementsidentical([0]) = 1
                                          : 19 of these are summed with +
20: 44440b44ạ/ : 44440 base 44 = [22,42,0].
               : ạ/ takes the absolute difference of terms: ||22-42|-0| = 20
21: ”TOHH : ”T is the character literal "T". OHH returns its ascii value 84 (O) halved twice (HH) = 21
22: literal 22

Try all at once or Try one at a time (argument is which output you want).

Unused characters:

¡¢£¤¥¦©¬®µ½¿€ÆÇÐÑÞßæçðȷñ÷øœþ !"#$%&'()*.:<=?@BFGIJKMPQRUVWXYZ[\]^_`acdefghijklmnopqrstuvwxyz{|}¶°¹³⁶⁷⁸⁹⁺⁻⁼⁽⁾ƁƇƊƑƓƘⱮƝƤƬƲȤɓƈɗƒɠɦƙɱɲƥʠɼʂƭʋȥẠḄḌẸḲḶṂỌṚṢṬỤṾẈỴẒȦĊĖḞĠḢİĿṀṄȮṖṘṠẆẊẎŻḅḍẹḥịḳḷṃṇọṛṣṭụṿẉỵẓȧḃċḋėḟġḣŀṁṅȯṗṙṡṫẇẋẏż«’
\$\endgroup\$
  • \$\begingroup\$ You're using A for both 2 and 4, no? \$\endgroup\$ – Dennis Jun 3 '17 at 22:37
  • \$\begingroup\$ @Dennis My TIO link was correct, but my explanation was different. Fixed \$\endgroup\$ – fireflame241 Jun 3 '17 at 23:37
  • 1
    \$\begingroup\$ I see. Btw if you put 22¹£€Y in the main link, you can execute all snippets at once. tio.run/##y0rNyan8///hzjauOsc6Ry5jLt0jG3UPbTq0icuUy4zLnMuC6/… \$\endgroup\$ – Dennis Jun 4 '17 at 5:01
4
\$\begingroup\$

Reng, score 40, 149 bytes

Try it here!

1.  e
2.  2
3.  ::l
4.  4
5.  5
6.  i`i`i`i`i`i`+++++
7.  7
8.  8
9.  9
10. A
11. ÇÇÇǹ
12. C
13* [[[[[[[[[[[[[mn~
14. E
15. F
16. G
17. H
18. I
19. J
20. K
21. L
22. M
23. N
24. O
25. P
26. Q
27. R
28. S
29. T
30. U
31. V
32. W
33. X
34. Y
35. Z
36. 6²
37. "%"
38* &fæ¦
39. D3*
40. 11±$1±±±±±±±±$11±$1±±±±$±$

All uppercase letters are numbers, so that's nice. All but two of these are snippets. The two that are programs:

13. [[[[[[[[[[[[[mn~
38. &fæ¦

The link provided allows one to see the stack while running. I'll write an explanation later.

\$\endgroup\$
4
\$\begingroup\$

CJam, score 27, 168 bytes

1-3: X, Y, Z

The variables X, Y, and Z are initialized to 1, 2, and 3, respectively.

4: ",,,,",

Push the string ,,,, and take the length.

5-9: 5, 6, 7, 8, 9

Numeric literals.

10-20: A-K

Preinitialized variables.

21: U)))))))))))))))))))))

The variable U is initialized to 0. Push U and increment it 22 times.

22: 22

Numeric literal.

23: ';(((((((((';((((((((

Push the character ; and decrement it 9 times to get 2, then push ; again and decrement it 8 times to get 3.

24: 4m!

Take the factorial of 4.

25: TT=TT=+TT=TT=TT=TT=TT=++++

TT= pushes 1. This code is equivalent to 1 1+1 1 1 1 1++++.

26: N:i~W-W-W-W-W-W-W-W-W-W-W-W-W-W-W-W-

N pushes a string containing a newline. :i converts it into a list of character codes, yielding [10]. ~ unpacks it, giving 10. W- is the equivalent of adding one. Incrementing 10 sixteen times gives 26.

27: LLLLLLLLLLLLLLLLLLLLLLLLLLL0]0#

Find the index of 0 in a list where 0 is at the 27th index.

Characters still available: $%&*./1<>?@MOPQRSV[\^_`abcdefghjklmnopqrstuvwxyz{|}

A few notes for potential expansion:

  • I might have to change 10-20 in order to use the variables for something else. If I get numbers higher than 1, I can use * (and possibly bitwise operators, but I don't think they'll help much).

  • I still have S, whatever good that'll do me.

  • If I change 26 to N{}/iW-W-W-W-W-W-W-W-W-W-W-W-W-W-W-W-, then : will be available.

  • I can push some empty lists and get more zeroes with existing variables. I can also get π, but that doesn't seem very useful unless I can cast it to an integer somehow, and m (for m[) and i are already taken.

  • In terms of array manipulation, I can:

    • Use a map with % or f
    • Use a fold with *
    • Do some setwise operations
    • Base conversion (this seems promising, but I don't know how I would get the base number)
    • Construct arrays by using |: M1|2|3|
\$\endgroup\$
  • \$\begingroup\$ Just a note, you could make 21 be U))))))))))))))))))))) and 22 be 22 which would free 1 for a later snippet. \$\endgroup\$ – Business Cat Jun 5 '17 at 14:16
  • \$\begingroup\$ @BusinessCat Thanks, edited. \$\endgroup\$ – Esolanging Fruit Jun 5 '17 at 17:58
  • \$\begingroup\$ To convert pi to an integer, you could make use of the fact that base conversion does an implicit :i on the digit list (e.g. [P]1b gives 3). \$\endgroup\$ – Martin Ender Jun 7 '17 at 14:15
  • \$\begingroup\$ If you don't mind making 23 a lot longer you could use '' instead of '; and then use enough ( to wrap around to the digits (so about 65k ( for each digit). That would free up ; for something else, but I'm not sure how useful that is. \$\endgroup\$ – Martin Ender Jun 7 '17 at 14:16
  • \$\begingroup\$ @MartinEnder I'll do that if I see a use for ;, but at the moment I can't. \$\endgroup\$ – Esolanging Fruit Jun 11 '17 at 22:38
4
\$\begingroup\$

Haskell, score 13, 86 bytes

pi/pi
sum[sum[]^sum[],sum[]^sum[]]
3
4
5
6
7
8
9
length"eeeeeeeeee"
11
2+2+2+2+2+2
0xD

Try it online!

Thanks to Ørjan Johansen for finding a way to fix my letter overlap while preserving the score of thirteen. (Also for going out of their way to notify me about this while this answer was deleted.)

pi/pi is 1.0.
sum[] evaluates to 0, 0^0 to 1 and sum[1,1] to 2. 3 to 9 just decode themselves.
length"eeeeeeeeee" yields the length of the string, which is 10.
2+2+2+2+2+2 is 12.
0xD is hexadecimal for 13.

\$\endgroup\$
  • \$\begingroup\$ You have some letter overlap. \$\endgroup\$ – xnor Jun 4 '17 at 19:12
  • \$\begingroup\$ @xnor Thanks for pointing out. Should be fixed now. \$\endgroup\$ – Laikoni Jun 5 '17 at 18:40

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.