Comments on Output 256 in many different ways
Parent
Output 256 in many different ways
Challenge
Write as many functions, programs, or snippets of code, that result in 256. Your score is the number of separate solutions submitted in an answer.
The challenge? The characters used in one solution must not appear in any other solution. That is, there is no character used in more than one program.
Notes
- The bytes of the solution, in the encoding used by the interpreter/compiler running the solution, are what is used for distinctness checking. For example, if the answer is scored in UTF-8, one solution containing
á
means no other can containé
as both share the0xC3
byte, but an SBCS containing both would allow it. - Solutions must have at least one character (otherwise the empty program giving 256 would result in a score of $\infty$).
- The usage of bytes for scoring means that the maximum score ever achievable is 256 (but getting that would mean having a language where every character prints 256).
- The result can be either a number, that equals to 256 (or differs from it by a maximum of 0.001), or a string representing it in decimal form, possibly ending with
.0
. - Each submission can be of a different type (function, program, snippet), and can return in a different format (return value, STDOUT, console, etc.)
- Yes, snippets of code are allowed. So
256
is a valid solution in most languages. - Highest score wins!
JavaScript, 11 solutions …
4y ago
Japt, 10 11 13 15 solutions …
3y ago
[Raku], 18 solutions 25 …
4y ago
C, 8 solutions Standard C, …
4y ago
Japt, 27 Solutions This sta …
3y ago
Vyxal, 20 23 24 solutions T …
3y ago
BQN, 14 solutions (SBCS) Ru …
3y ago
[Husk], 9 solutions 1. Clas …
4y ago
[PowerShell], 4 solutions …
3y ago
Scala (`-language:postfixOps`) …
3y ago
[Ruby], 7 solutions ```ruby …
3y ago
Unlambda, 1 solution Since …
3y ago
Post
Japt, 27 Solutions
This started out as a collaboration with Quintec but quickly got very out of hand! Posted with their permission.
More solutions to follow. Hopefully!
256
Just the boring, literal 256
.
3^7^73^333
Some bitwise XORing.
4²²
4
raised to the power of 2
twice.
8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8--8
-8
subtracted from 8
repeatedly until we get to 256
.
ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ9à
9à
gives us the number of possible combinations of an array of length 9
, which is 511
. Ó
is the shortcut for ~-
so we're getting the bitwise NOT of the negation of 511
until we get back down to 256
.
[BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB]è
B
is 11
, which in itself is irrelevant, what's important is that there are 256 copies of it in the array and è
counts the truthy (non-zero) elements in it.
ÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒFÒF
F
is 15
and Ò
is the shortcut for -~
so the first ÒF
negates the bitwise NOT of 15
, giving us 16
and each subsequent one subtracts the bitwise NOT of 15
from that.
Gp
G
is 16
and p
is the exponentiation method, with a default parameter of 2
- so 16**2
.
HÑÑÑ
H
is 32
and Ñ
is the shortcut for *2
- so 32*2*2*2
.
Iz¼
I
is 64
, z
is the floor division method and ¼
is .25
- so 64/0.25
.
100000000sÍ
s
converts the 100000000
to a string and Í
is the shortcut for n2
which converts that from a binary string back to an integer.
½/½/½/½/½/½/½/½/½/½
Dividing .5
by itself repeatedly until we get to 256
.
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
These next few take advantage of the fact that if Japt is expecting a variable at the start of a line then it automatically inserts the first input variable U
, which defaults to 0
. In this one Ä
is the shortcut for +1
, so we're adding 1
to U
256 times.
µÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉÉ
µ
is the shortcut for -=
and É
is the shortcut for -1
so we're decrementing U
by -1
256 times.
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
is the shortcut for ++
so we're postfix incrementing U
until we get to 256
.
U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´,U´a
´
is the shortcut for --
so we're postfix decrementing U
until we get to -256
, with the comma providing separation so all the -
s don't run together and make a mess of things. The a
at the end gets the absolute value of the final value of U
.
JnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJnJ
J
is initially the integer -1
and n
is, effectively, inverse subtraction; that is XnY === Y-X
. So, starting at the end, we're subtracting -1
from -1
and then subtracting -1
from the result and repeating until we get to 256
.
T±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥TT±T¥T
T
is initially 0
, ±
is the shortcut for +=
and ¥
is the shortcut for ==
so each block of T±T¥T
is testing T
for equality with itself, which is always true
and then incrementing T
by that value, implicitly casting the true
to 1
.
V+++V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V+V
V
is the second input variable, which also defaults to 0
. We start by postfix incrementing it and then repeatedly adding it to itself until we get to 256
.
!P<<!P<<!P<<!P<<!P<<!P<<!P<<!P<<!P
P
is the empty string, which is falsey so negating that gives us true
so we just bitshift by !P
until we get to 256
, implicitly casting the true
to 1
each time.
SiSiSiSiSiSiSiS q xc
S
is the space character and i
is the prepend method. We prepend 7 copies of S
to itself, then split that string to an array with q
and then the x
reduces the array by addition after the c
first converts each character to its codepoint, 32
. The spaces are used to close the (nested) methods.
`Ü?Áÿe`¬ì`
Ü?Áÿe
is the compressed string "deeeeeeee" which gets decompressed by the backticks. ¬
is the shortcut for q
which, as above, splits the string to a character array. The ì
converts the array from a custom digit array to decimal with the custom base being the unprintable
(charcode 130) at the end which the last backtick decompresses to ed
. (Note to self: Find a pair of characters that compresses better so I can get the Á
& e
back to potentially use later)
#Ā
#
returns the codepoint of the character that follows it.
N³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³l
N
is the (empty) array of inputs and ³
is the shortcut for p3
which, when applied to an array, pushes 3 to the array. We do that 256 times and then get the length of the array with l
.
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"aa
A string of 257 "a"s with the aa
at the end getting the last 0-based index of a
in that string.
$'________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________b'$bb
Similar idea to the above; repeat a random character 256 times and add a "b" at the end. The bb
then gets the first 0-based index in the string. '
can only be used to quote a single character in Japt and there is no closing '
(e.g., 'b === "b"
) so we use the $
s to switch in and out of plain old JavaScript, allowing the '
s to be used as normal.
(¤*(¤*(¤*(¤*(¤*(¤*(¤*(¤
Here's where the real fun begins! ¤
is the shortcut for s2<space>
but when we add the (
before it, Japt interprets the whole thing as ("s",2)
(with the space serving as the closing bracket). The comma cause the "s"
to be ignored in each case, leaving us with the 2
s which we then multiply together enough times to give us 256
.
1 comment thread