Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Comments on Output 256 in many different ways

Parent

Output 256 in many different ways

+13
−0

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 the 0xC3 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!
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (6 comments)
Post
+6
−0

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

Try it

Just the boring, literal 256.


3^7^73^333

Try it

Some bitwise XORing.


4²²

Try it

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

Try it

-8 subtracted from 8 repeatedly until we get to 256.


ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓ9à

Try it

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]è

Try it

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

Try it

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

Try it

G is 16 and p is the exponentiation method, with a default parameter of 2 - so 16**2.


HÑÑÑ

Try it

H is 32 and Ñ is the shortcut for *2 - so 32*2*2*2.


Iz¼

Try it

I is 64, z is the floor division method and ¼ is .25 - so 64/0.25.


100000000sÍ

Try it

s converts the 100000000 to a string and Í is the shortcut for n2 which converts that from a binary string back to an integer.


½/½/½/½/½/½/½/½/½/½

Try it

Dividing .5 by itself repeatedly until we get to 256.


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

Try it

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.


Try it

°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°
°

Try it

° 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

Try it

´ 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

Try it

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

Try it

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

Try it

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

Try it

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 1each time.


SiSiSiSiSiSiSiS       q xc

Try it

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`¬ì`‚

Try it

Ü?Áÿ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)


Try it

# returns the codepoint of the character that follows it.


N³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³³l

Try it

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

Try it

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

Try it

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.


(¤*(¤*(¤*(¤*(¤*(¤*(¤*(¤

Try it

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 2s which we then multiply together enough times to give us 256.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

General comments (2 comments)
General comments
Quintec‭ wrote over 3 years ago

I have to say I absolutely love the last one

Shaggy‭ wrote over 3 years ago

@Quintec, if you enjoyed that, you'll fecking love this! Especially when you see how we made 39!