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
Vyxal, 20 23 24 solutions
Thanks to @Razetime for suggesting using Π
, allowing for +1 solution.
The programs are meant to be run individually, so the ,Ṡ_
is just there to output the previous line and clear the stack. You can try any solution individually to verify.
I gave myself the challenge of doing this without looking at any other answers, and I'm pretty happy with how it turned out!
Here's explanations for each program. In the more complicated ones, [stuff]
at the end of the line indicates the current stack.
Note: Two programs have a space in them, but that is only for readability and formatting. In either program, the space could be replaced with a linefeed and it would still function the same.
₈ # Push 256
256 # Push 256
₇d # 128 * 2
₆4* # 64 * 4
\Ā # Push 'Ā'
C # To ordinal value
⇧₴ # Increment 2 and print
⇧⇧⇧‹₴ # Increment 6, decrement, and print
⇧⇧⇧₴ # Increment 6 and print
›› # Increment 2 - [2]
S # To string - [`2`]
? # Get input. No input, so push 0 - [`2` 0]
›››››S # Increment 5, to string - [`2` `5`
J # Join with last string - [`25`]
?››››››SJ # Again, incrementing to 6 - [`256`]
8E # 2 ** 8
₀ # Push 10
⇩ # Decrement 2
Ǎ # 2 ** 8
ꜝ # Bitwise not - [-1]
₌ȧȧ # Parallel apply absolute value and absolute value - [1 1]
₌↲↲ # Parallel apply 'a << b' and 'a << b' - [2 2]
~↲ # Do 'a << b' without popping the stack - [2 2 8]
e # Exponentiate - [2 256]
u # Push -1 - [-1]
⌐ # 1 - a - [2]
u⌐u⌐u⌐u⌐u⌐u⌐u⌐ # Several more times - [2 2 2 2 2 2 2 2]
W # Wrap stack - [[2,2,2,2,2,2,2,2]]
Π # Reduce by multiplication - [256]
k¶½ # 512 / 2
¤ # Push empty string - [``]
₁ # Push 100 - [`` 100]
+ # Add - [`100`]
H # Convert from base 16 - [256]
¬ # Not - [1]
: # Duplicate - [1 1]
Ṡ # Sum of stack [2]
:Ṡ # Repeat - [4]
:Ṡ # [8]
:Ṡ # [16]
:Ṡ # [32]
:Ṡ # [64]
:Ṡ # [128]
:Ṡ # [256]
»ƛN» # Push compressed number 332
∆K # Sum of proper divisors
‛λḢ # Push dictionary word 'business'
m # Palindromize - [`businessssenisub`]
mmmm # A few more times - [`BigLongStringOfCharacters`]
L # Length of string - [256]
! # Length of stack - [0]
! # Length of stack - [0 1]
! # Length of stack - [0 1 2]
...Many, many, more...
! # Length of stack - [0 1 2 .. 256]
. # Push 0.5 - [0.5]
. # Push 0.5 - [0.5 0.5]
/ # Divide - [1.0]
I # To int - [1]
øṁ # a + palindromized(a) - [2]
øṁ # Again - [4]
øṁ # [8]
øṁ # [16]
² # Squared - [256]
⁺ṡ # 101 + codepage value of 'ṡ' (0x9B)
ǎ # ath prime - [2]
ǎ # ath prime - [5]
0 # Push 0 - [5 0]
₄ # Push 26 - [5 0 26]
0₄0 1 # Some more numbers - [5 0 26 0 26 0 1]
- # Subtract - [5 0 26 0 26 -1]
- # [5 0 26 0 27]
- # [5 0 26 -27]
- # [5 0 53]
ǎ # ath prime - [5 0 251]
- # Subtract - [5 -251]
- # Subtract - [256]
= # a == b? - [1]
⁽₃ # Push lambda - [1 lambda_
⁽₃ # Push lambda - [1 lambda_ lambda_]
= # a == b? = [1 0]
" # Wrap a and b - [[1,0]]
⁽₃⁽₃=" # Repeat - [[[1,0],0]]
⁽₃⁽₃="⁽₃⁽₃="⁽₃⁽₃="⁽₃⁽₃="⁽₃⁽₃="⁽₃⁽₃=" # Some more - [[[[[[[[[1,0],0],0],0],0],0],0],0]]
f # Flatten list - [[1,0,0,0,0,0,0,0,0]]
B # Convert from base 2 - [256]
`≬„¾⅛` # Push string
`≬‡„↵¼¾⅛□‟₅` # Push other string
β # Convert a from custom base b
«Þ« # Push compressed string - [`e `]
3 # Push 3 - [`e ` 3]
ɽ # Range [1..a) - [`e ` [1,2]]
G # Maximum of a - [`e ` 2]
«ƈ« # Push compressed string - [`e ` 2 `ee`]
3ɽG3ɽG3ɽG # Some more 2s - [`e ` 2 `ee` 2 2 2]
p # Prepend - [`e ` 2 `ee` 2 22]
pppp # A few more times - [`222ee2e `
Ṅ # Separate by spaces - [`2 2 2 e e 2 e `]
Ė # Evaluate as Vyxal code - [256]
79 # Push 79 - [79]
¦ # Cumulative sum - [[7,16]]
¦ # Cumulative sum - [[7,23]]
¦ # Cumulative sum - [[7,30]]
¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ # A bunch more - [[7,191]]
t # Tail - [191]
¦ # Cumulative sum - [[1,10,11]]
¦¦¦¦¦¦¦¦¦¦¦¦¦¦ # And then some more - [[1,24,256]]
t # Tail - [256]
1 comment thread